In MasterPage i added a label and One ContentPlaceHolder, This is My MasterPage code snippet to demonstrate
»I added a TextBox inside ContentPlaceHolder of Asp.Net page that uses a master Page.
»To find the 'Label' controls of Master page just add the following line in CodeBehind(.cs) page
Happy Coding
<form id="form1" runat="server">
<div><asp:Label ID="lblUN" runat="server"Text="Raji">asp:Label>div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"runat="server">
asp:ContentPlaceHolder>
</form>
<asp:Content ID="Content1"ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server" >
<asp:TextBox ID="txtUName" runat="server"Text="Raji">asp:TextBox>
</asp:Content>
»To find the 'Label' controls of Master page just add the following line in CodeBehind(.cs) page
Label l = Master.FindControl("lblUN") as Label;
How To Find The Controls In a Page
»To find the controls in page just use the following code snippet
TextBox TB= Master.FindControl("ContentPlaceHolder1").FindControl("txtUName")as TextBox;
Happy Coding
No comments:
Post a Comment