问题描述
RadButton chkselect = new RadButton();
RadButton chk = new RadButton();
foreach(RadGrid1中的GridDataItem grditem。 MasterTableView.Items)
{
chkselect = grditem.FindControl(chkselect)作为RadButton;
chk = grditem.FindControl(checkbox1)作为RadButton;
if(chkselect.Checked)
{
((RadButton)grditem.FindControl(checkbox1))。Checked = true;
}
}
RadButton chkselect = new RadButton();
RadButton chk = new RadButton();
foreach (GridDataItem grditem in RadGrid1.MasterTableView.Items)
{
chkselect = grditem.FindControl("chkselect") as RadButton;
chk = grditem.FindControl("checkbox1") as RadButton;
if (chkselect.Checked)
{
((RadButton)grditem.FindControl("checkbox1")).Checked = true;
}
}
推荐答案
foreach (GridDataItem grditem in RadGrid1.MasterTableView.Items)
{
RadButton chkselect = grditem.FindControl("chkselect") as RadButton;
if (!Equals(chkselect,null) && chkselect.Checked)
{
((RadButton)grditem.FindControl("checkbox1")).Checked = true;
}
}
这篇关于调试此代码时,我收到null异常错误。代码是通过复选框检查网格中的所有复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!