Click here to Skip to main content
15,904,494 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to work with textbox change event inside the gridview.
Posted
Updated 1-Dec-10 0:13am
v2

On row databound event create a textchanged event.
TextBox txt = e.Row.FindControl("TextBox1") as TextBox;
 txt.TextChanged += new EventHandler(TextBox1_TextChanged);

protected void TextBox1_TextChanged(object sender, EventArgs e)
{
//your code
}
 
Share this answer
 
Comments
kavita painter 27-Dec-13 4:30am    
i used this code bt my textchanged event not fired
Mohit1984 1-Dec-10 6:50am    
when i use this code then error comes like
Object reference not set to an instance of an object.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
TextBox txt = e.Row.FindControl("TextBox1") as TextBox;
txt.TextChanged += new EventHandler(TextBox1_TextChanged);

}
m@dhu 3-Dec-10 0:24am    
Check whether you are giving correct idof textbox. I gave TextBox1 as example.

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