Tutorials
ASP.NET 2.0
ASP.NET 2.0: Referencing Master Page Members
ASP.NET 2.0: Referencing Master Page Members - Page 2.
.

The < span > element marked runat=server is mapped to an HTMLGenericControl object and its text content is exposed through the InnerText property. This property is wrapped by a new public property “SubTitle” that gets and sets the value of the InnerText property on the < span > tag.
Now this property can be invoked from the master if the SubTitle propertyis defined on the MasterPage class. This is because the MasterPage class represents the masterpage object which is compiled at runtime. The ClassName attribute on the @Master directive allows the assignment of user defined names to the master page class. Therefore the master property must be cast to the actual type to be able to call custom properties. The following code will have to be added to the content page
((MasterPage)Master).SubTitle= “Welcome”;

Now add the following code to the content page.
< script runat= “Server” >
.........Void Page_Load(object sender, EventArgs e)
.........{
..................Master. SubTitle = “Welcome”;
.........}
< /Script >

First Page: ASP.NET 2.0: Referencing Master Page Members
|
First of all thnx a ton for a great post. I'm a biggner to asp.net. I'm not getting this line: The following code will have to be added to the content page ((MasterPage)Master).SubTitle= “Welcome”; Where to put this line exactly?? Hope u reply this stupid question. Regards |