Textbox Enter Values Even Display Another LABEL or TEXTBOX in Asp.Net C#



If you enter textbox in values even display another Label or Textbox show  same values 


Select one Label from  ToolBox  - Give to ID name Label1 



Textbox values show to label 





Select one textbox  from tool box - give Id name TextBox1 & AutoPostback = True and  textbox double click -coding give to below like that 


protected void TextBox1_TextChanged(object sender, EventArgs e)

{
   Label1.Text = Server.HtmlEncode(TextBox1.Text);

}





Design


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
    <div>
          <table><tr><td><asp:TextBox ID="TextBox1" runat="server"
 AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>     
    </td>
        <td><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></td></tr></table>
       
       
    </div>
    </form>
</body>
</html>



OUTPUT










0 comments:

Post a Comment