views:

57

answers:

1

Using SPGridView, I want to fill textboxes with the SPGridview Selected Row Data on a button click event.

txtCode= SPGridView.SelectedRow.Cell[1].Text;

On debugging, it shows Cell[1] is empty but it is showing data in the Grid.

How can this be achieved?

+1  A: 

Hi!

Remember that cell index start at 0.

you can also try this

((TextBox)SPGridView.Rows[SPGridView.SlectedIndex].Cells[1].Controls[0]).Text;
Guilherme Ferreira