I need to ask if I have master page that contain button as an example then I add new webform(default) and I assign that master page as default form master page.the question is can I change the text of the button in default page code?
I would use a property on the master page to change the button, I think you can make it public but meh.
public String ButtonText { get { return button1.text; } set { button1.Text = value } }
Then on the default page, set the master type.
<%@ MasterType VirtualPath="~/mymaster.master" %>
Then on the default page you should be able to access by going through the property.
Master.ButtonText = "Hello, Master Page Button";
[Sorry, assuming C#]
If you put the MasterType directive on your default page
<%@ MasterType VirtualPath="~/Master1.master" %>
then you can call methods and properties on the master page in the code-behind:
MyButton.Text = "New text";
For more information see ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps
sure you can, it's either way...
you should see the video screencasts about MAster Pages, you will see how to accomplish that and much more!
Video # 12 MasterPages 16 minutes, 2 seconds
Video # 36 How Do I: Work with Master Pages Declaratively and Programmatically 29 minutes, 49 seconds
Video # 37 How Do I: Handle Events in Master and Content Pages 23 minutes, 26 seconds