i have an admin master page where i want to place a label which i can control with two functions (setErrorMessage and setSuccessMessage) both functions assign strings to label's text property and change CssClass property according to function type.
I want to use these functions from nested pages while the control remains centralized on master page so i can return to form in case of error so user could edit wrong input.
How would you suggest me to do that ? either VB or C#
thanks
You can use below in .aspx
<%@ MasterType VirtualPath="~/MasterPages/Default.master" %>
and below in your code behind,
this.Master.yourMethod
this.Master.yourProperty
to access your controls in child page.
您必须在嵌套页面中转换Master属性的类型:
((MyMasterPage)this.Master).lblMessage.Text = "Hi.";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.