Here i have given two scenarios to explain those importance in asp.net
In case of a control which is placed in a web form without Master Page:
The Id and Name attribute rendered to the browser are same as Id of control on server and thus the same Id/Name can be used
for programming a control in java script
In case of a control which is placed in a web form with Master Page:
In case of a control which is placed in a web form without Master Page:
The Id and Name attribute rendered to the browser are same as Id of control on server and thus the same Id/Name can be used
for programming a control in java script
In case of a control which is placed in a web form with Master Page:
The control Client side Id="<%=ServerofControl.ClientID%>" example:ct100_ContentPlaceHolderId_ServerIdofControl The control Client side Name="<%=ServerofControl.UniqueID%>" example:ct100$ContentPlaceHolderId$ServerIdofControl1.Add a text box and HTML button to webform/content page which has been page
<asp:TextBox runat="server" ID="txtwform"/> <input type="button" value="cbutton" onclick="Show()"/>2.Add the following to the web form (cphHead isId of ContentPaveHolder added to Head Section of Master Page)
<asp:Content ID="chead" ContentPlaceHolderID="cphead" runat="server"> <script> function Show() { var test=document.<%=Page.Form.ame%>.<%=txtwform.UniqueID%>; alert(test.value); }
</scrip>
No comments:
Post a Comment