现有一个AspxGridView,外面有一个保存按钮,当点击按钮的时候,把AspxGridView里的CheckBox的Checked值取出来,怎么取呢,在按钮的Click事件里写:
for (int i = 0; i < G1.VisibleRowCount; i++)
{
CheckBox chkselect = G1.FindRowCellTemplateControl(i, (GridViewDataColumn)G1.Columns[2], "chkSelect") as CheckBox;
CheckBox chkupdate = G1.FindRowCellTemplateControl(i, (GridViewDataColumn)G1.Columns[3], "chkUpdate") as CheckBox;
CheckBox chkDelete = G1.FindRowCellTemplateControl(i, (GridViewDataColumn)G1.Columns[4], "chkDelete") as CheckBox;
chkselect.checked=true;}
报错:未将对象引用到对象的实例