Click here to Skip to main content
15,171,993 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to do verification of textbox just after entering data not on button click.
any one having code pls forward it.
thanks in advance.
Posted

Inside Updatepanel, use TextChanged event on the TextBox

void textBoxName_TextChanged(object sender, EventArgs e)
{
//you code here
}

-regards,
Karthik.J
   
You can do this using the javascript on 'onblur' event of textbox.

Try something like this:

ASP.NET
<asp:textbox id="your_id" runat="server" onblur="your script function" />
   
v2
Use TextChanged event on TextBox

C#
void textBox1_TextChanged(object sender, EventArgs e)
{
    //you code for verify
}
   
Comments
SamWakchaure 6-Sep-12 0:35am
   
thanks i need only.
you should have write more detail about what you have to verify. for example I have verify the text with text length not less then 8 and not greater then 22. Create one textbox (TB) and one Lable (lB)
here the code:
C#
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            lB.Text = test(tb.Text);
        }
        public string test(string test){
            int a=test.Length;
            if (a > 8  && a<22)
            {
                return "Ok";
            }
            else
            {
                return "Not Valid";
            }
            }
        }
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900