Use OnTextChanged event in ASP.NET TextBox

OnTextChanged event in TextBox – ASP.Net

How to user onTexchanged event in TextBox control in ASP.Net

 

- If we want to use onTexchanged event of TextBox we must Set AutoPostBack = True of TextBox Control.

- write below code in Body Tag : -

<body>
    <form id=”form1″ runat=”server”>
    <div>
        <table border=”1″ bordercolor=”#000000″ style=”z-index: 100; left: 320px; position: absolute;
            top: 80px”>
            <tr>
                <td colspan=”3″>
                    <asp:Image ID=”Image1″ runat=”server” ImageUrl=”~/img/newimg.png” /></td>
            </tr>
            <tr>
                <td colspan=”3″ rowspan=”2″ style=”height: 21px; text-align: center”>
                    <table>
                        <tr>
                            <td style=”width: 100px; text-align: right”>
                                Enter Value :</td>
                            <td style=”width: 100px”>
                                <asp:TextBox ID=”txtvalue” runat=”server” AutoPostBack=”True” OnTextChanged=”txtvalue_TextChanged”></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style=”width: 100px; text-align: right”>
                                Answer :</td>
                            <td colspan=”1″ style=”text-align: left”>
                                <asp:TextBox ID=”txtanswer” runat=”server”></asp:TextBox>
                                </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
            </tr>
        </table>
    
    </div>
    </form>
</body>

Write below code on OnTexchanged Event of TextBox

 protected void txtvalue_TextChanged(object sender, EventArgs e)
    {
        txtanswer.Text = txtvalue.Text;
    }

TextBox Control OnTextChanged Events

TextBox Control OnTextChanged Events

TextBox Control OnTextChanged Events

TextBox Control OnTextChanged Events

-I hope you enjoyed this ASP.NET TextBox Example Post.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + 7 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">