I had a DataGrid that had a checkbox column. I needed each of the values that were already true in the database (1) to show on the datagrid accordingly. I just looped through my values and when I had a matching value I added that index to an ArrayList. Then I just set the SelectedIndexes property:
RowSelectorColumn rsc = dg.Columns[0] as RowSelectorColumn;
rsc.SelectedIndexes = (int[])selectedIndexes.ToArray(typeof(Int32));
Worked like a charm. Now I had another datagrid that had radio buttons instead of checkboxes. I thought I'd go through and just do something like:
rsc.SelectedIndexes[0] = selectedIndex;
Which didn't work. Turns out that this is what you need to do:
rsc.SelectedIndexes = new int[1] {selectedIndex};
FireFox also had a wierd error of not initially selecting the radio button. I would view the source, see the attribute checked="checked" and yet, the box wasn't checked. I went into IE, worked fine, a few minutes later FF started acting correctly. This did cause confusion, so if you run into just check your source. If it's there, it's rendering correctly, FF just hasn't updated something yet.