int selectedIndex = radGridView1.Items.IndexOf(radGridView1.SelectedItem);//Index of the row
var selectedRow = radGridView1.ItemContainerGenerator.ContainerFromIndex(selectedIndex) as GridViewRow; //Selected Row
var columnNumber = selectedRow.Cells[0] as GridViewCell; //Number of the column
textBox1.Text = columnNumber.Value.ToString(); //Cell from selected row + number Column
columnNumber = selectedRow.Cells[1] as GridViewCell;
textBox2.Text = columnNumber.Value.ToString();
Although your approach for populating your TextBoxes is a possible one, I would like to caution you that it can lead to some issues. Since RadGridView by default uses UI virtualization. For example if you select a row and then scroll down / up and the selected row goes out of the visible area, then your approach will not work. That is so because the ItemContainerGenerator relies on the selected row to be in the viewport. That is why youcan not rely on the visual elements when the UI Virtualization is enabled. Please note that all the visual elements (for example GridViewCell, GridViewRow) will be created as they are brought into view. Then all the visual elements will be re-created when they go beyond the visible area and then come back into view.
Another possible approach to this issue is to bind your TextBoxes in XAML like so:
I attached a sample project that demonstrates the suggested approach.
I hope this helps.
Regards,
Boris
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.