Tuesday, 29 July 2014

How to use Associated control Id in ASP.NET Label

How to use Associated control Id in ASP.NET Label

  1. <%@ Page Language=“C#” %>

  2. <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

  3. <script runat=“server”>

  4. </script>

  5. <html xmlns=“http://www.w3.org/1999/xhtml”>
  6. <head id=“Head1″ runat=“server”>
  7.     <title>How to use associated control id (AssociatedControlID) in Label</title>
  8. </head>
  9. <body>
  10.     <form id=“form1″ runat=“server”>
  11.     <div>
  12.         <h2 style=“color:Navy”>Label Example: AssociatedControlID</h2>
  13.         <asp:Label
  14.              ID=“Label1″
  15.              runat=“server”
  16.              ForeColor=“CadetBlue”
  17.              Text=“<u>U</u>ser Name”
  18.              ToolTip=“Color label”
  19.              AccessKey=“U”
  20.              AssociatedControlID=“TextBox1″
  21.              >
  22.         </asp:Label>
  23.         <asp:TextBox
  24.              ID=“TextBox1″
  25.              runat=“server”
  26.              BackColor=“SeaGreen”
  27.              ForeColor=“AliceBlue”
  28.              >
  29.         </asp:TextBox>
  30.     </div>
  31.     </form>
  32. </body>
  33. </html>


No comments:

Post a Comment