D
DJE
Using DataGridViewRadioButtonColumn/Cell (http://msdn2.microsoft.com/
en-us/library/aa730882(VS.80).aspx) I want to select in all rows, 1 of
3 radiobuttons in a column of my datagridview programmatically. I am
trying:
string selectedRadioButton=1;
foreach(DataGridViewRow row in Grid.Rows)
{
//get the cell in the 11th column
DataGridViewRadioButtonCell radioButton =
(DataGridViewRadioButtonCell)(row.Cells[11]);
// Update the value of the cell (with a string)
This string should exist as a value of
// your bound datasource's DisplayMember field.
radioButton.Value = selectedRadioButton;
// Update the cell.
Grid.UpdateCellValue(11, row.Index);
}
So I expect this to select the second radio button in each cell. But
radioButton.Value=selectedRadioButton always is null after the
assignment. I have the column bound to an object with 2 fields
(ValueMember=Id and DisplayMember=Description). and the grid in
virtual mode. What do I have to do to set this radio button?
en-us/library/aa730882(VS.80).aspx) I want to select in all rows, 1 of
3 radiobuttons in a column of my datagridview programmatically. I am
trying:
string selectedRadioButton=1;
foreach(DataGridViewRow row in Grid.Rows)
{
//get the cell in the 11th column
DataGridViewRadioButtonCell radioButton =
(DataGridViewRadioButtonCell)(row.Cells[11]);
// Update the value of the cell (with a string)
This string should exist as a value of
// your bound datasource's DisplayMember field.
radioButton.Value = selectedRadioButton;
// Update the cell.
Grid.UpdateCellValue(11, row.Index);
}
So I expect this to select the second radio button in each cell. But
radioButton.Value=selectedRadioButton always is null after the
assignment. I have the column bound to an object with 2 fields
(ValueMember=Id and DisplayMember=Description). and the grid in
virtual mode. What do I have to do to set this radio button?