Hello,
i have web application which as master page and child page.
i have one label on master page. i am able to access this label control in any child page like follow
child.aspx
<%@ MasterType VirtualPath="~/MasterPage/Site1.Master" %>
child.aspx.cs
((Label)this.Master.FindControl("lblsample")).Text = "Welcome ";
But, there is situation i should show master page content. so i created new webform called 'newlogin.aspx 'without master page which has head,body tag.
now if i try access master page control label in newlogin.aspx.cs, i am getting NULL reference exception.
newlogin.aspx
<%@ MasterType VirtualPath="~/MasterPage/Site1.Master" %>
newlogin.aspx.cs
((Label)this.Master.FindControl("lblsample")).Text = "Welcome ";
I am getting NULL reference exception as it is not finding.
how to access master page controls in this situation.