Badis wrote:
I'm doing it in a CheckedChanged event of a RadioButton in a TemplateField of
MyGridView
protected void MyRadioButton_CheckedChanged(object sender, EventArgs e)
{
TextBox.Text = MyGridView.SelectedRow.Cells[1].ToString();
}
Hi,
You need to make sure that the SelectedIndex property is not set to -1
when you try to access the SelectedRow.
There has to be a command type control somewhere in your template (e.g.
button or LinkButton) that generates a postback event and is assigned
the string value "Select" to its CommandName property (a RadioButton
control can't be used for this). That will raise a SelectIndexChanged
event and the SelectedRow property will then point to an actual row of
the grid.
HTH