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 b开发者_运维技巧e achieved?
I've just got similar problem. And I've find out that "selectedvalue" is solution. so try :
txtCode.Text = Convert.ToString(oSPGridView.SelectedValue);
Remember that cell index start at 0.
you can also try this
((TextBox)SPGridView.Rows[SPGridView.SlectedIndex].Cells[1].Controls[0]).Text;
精彩评论