Thursday, February 17, 2011

How to find RowIndex for gridview when textbox text is changed ?

Hi All,


If you have a textbox inside the gridview , Is it possible to find the RowIndex  with the help of ontextchanged event for textbox ?


Yes it is possible :-)


Simple steps you need to follow .


Step 1:

You need to set AutoPostBack as True for TextBox


Step 2:

You need to add ontextchnaged event for TextBox


For Example:






Step 3: 

Please add below code for you "ontextchanged" event




5 comments:

  1. thanks ,i had needed this code badly

    RS

    ReplyDelete
  2. it works and saved my whole day.

    I used DataGrid control and used the following code:

    int RowIndex = ((sender as TextBox).NamingContainer as DataGridItem).ItemIndex;

    ReplyDelete