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

[Solved] Row index needed while tabbing cells

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mala
Top achievements
Rank 1
Mala asked on 10 Apr 2009, 08:22 AM
Hi,

I have a RadGrid with Template columns (textboxes and dropdowns). The grid is always displayed in an edit mode. As user tabs in between grid cells, I need to run code behind to do validation as well as default and disable some other cells within the row being tabbed. If the TemplateColumn is a textbox and I tab out of it I do get the TextChanged event...but how do I know which row I am in? I need the row so I can default and disable the remaining cells on that row only. I tried using the RadGrid1_ItemDataBound event but it doesnt get fired when you tab between table cells. Here are some code snippets:

 

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)

 

{ // doesnt get called

}

 

protected void CategoryNameTextBox_TextChanged(object sender, EventArgs e)

 

{

// how can I get the row index here of the current cell?

 

 

}

Thanks, Mala

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Apr 2009, 12:47 PM
Hi Mala,

You can use the NamingContainer object of the text box:

int rowIndex = ((GridDataItem)(((TextBox)sender).NamingContainer)).ItemIndex; 

I hope this helps.

Best Regards,
Tsvetoslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mala
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or