This is a migrated thread and some comments may be shown as answers.

Capturing the modified row index on focused row change

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
vijayaraj
Top achievements
Rank 1
vijayaraj asked on 03 Nov 2008, 06:13 PM
Team,

   I am using the radgrid and i have template column which has textbox field.
I need to capture the textbox field values/text when I move out of the current row to the next row. so that i have to save the modified value in the DB and reload the grid.

Can you help me what method and what property to use to capture the row index  in the code-behind ?

Thanks
Vijay

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Nov 2008, 06:41 AM
Hello Vijayaraj,

You can capture the text values of a textbox in its TextChanged event and also access the row which it belongs to using the NamingContainer property as shown in the example below:
aspx:
 <telerik:GridTemplateColumn UniqueName="TemplateColumn1"
       <ItemTemplate> 
           <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" OnTextChanged="TextBox1_TextChanged" ></asp:TextBox>               
       </ItemTemplate> 
 </telerik:GridTemplateColumn>    

cs:
protected void TextBox1_TextChanged(object sender, EventArgs e) 
    { 
        TextBox txtbx = (TextBox)sender; 
        string strtxt = txtbx.Text; 
        GridDataItem dataItem = (GridDataItem)txtbx.NamingContainer; 
        int rowIndex = dataItem.ItemIndex; 
    } 

Thanks
Princy.
Tags
Grid
Asked by
vijayaraj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or