I want to change master page some label value from child page.
A:
Kangkan
2010-03-03 12:23:13
+4
A:
Create a property like this in master page:
public string MyText { get {return lbl.Text;} set {lbl.Text = value;}}
Once you do that you can use the same property in content page like:
((MasterPageTypeName)Page.MasterPage ).MyText = "test";
and you are done!
lakhlaniprashant.blogspot.com
2010-03-03 12:24:25
perfact i have check it.
AjmeraInfo
2010-03-03 20:09:26
+1
A:
Or you can just add '@mastertype' to the child page .aspx declaratively. This creates a strongly-typed reference to the masterpage.
<%@ MasterType VirtualPath="~/masters/SourcePage.master" %>
SoftwareGeek
2010-03-07 14:46:49
A:
Everything is fine,just need to change:
((MasterPageTypeName)Page.MasterPage ).MyText = "test";
to ((MasterPageTypeName)Page.Master ).MyText = "test";
that's it,you are done.
Avishek
2010-09-15 10:05:16