![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
protected void InformationGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
CheckBox cbx = e.Row.FindControl("cbxName") as CheckBox;
try
{
//传送CheckBoxID
cbx.Attributes.Add("onclick", "ChangeGet(" + cbx.ClientID + ")");
}
catch
{
}
}
<script language="javascript">
//接收传送的ID
function ChangeGet(SelectCheckBox)
{
//找所有input控件
var objs = document.getElementsByTagName("input");
for(var i=0; i<objs.length; i++)
{
if(objs[i].type.toLowerCase() == "checkbox" )
//设置找到的CheckBox控件为false
objs[i].checked = false;
}
//把选中的CheckBox控件设置为true;
document.getElementById(SelectCheckBoxID).checked = true;
}
</script>