Suppose there is a Label on the Master page that we want to write to from the Content page.
1. We must include a MasterType directive at the top of the Content page ASPX file:
<%@ MasterType virtualpath="~/DetailsMaster.master" %>
2. We must include a public function in the Master page that returns a typed reference to the Label:
VB.net
Public Function LabelReference() As LabelC#
' Create a reference to an actual label on the page
LabelReference = lblDetailsItemName
End Function
public Label LabelReference()
{
// Create a reference to an actual label on the page
return lblDetailsItemName;
}
3. We can access the Label from the Content page using the Master syntax:
Master.LabelReference.Text = "Demo text";
Hope that it will help for developer.
No comments:
Post a Comment