About the GridView Add a checkbox, how to use JS to add a radio event, in fact, the code is not very difficult, but the original also checked the information, only for record, master bypass ha. The format in ASPX is as follows:
<div> <table> <td>< Asp:gridview id= "Humidnmgridview" > <Columns> <asp:TemplateField> <HeaderTemplate> <asp:image id= "oimg" runat= "Server" imageurl= ". /.. /images/icon_sure.gif "> </asp:image> //icons can be ignored The following is javascript:
var clickcount = 0; //Judging the same checkbox continuous clicks var precheckboxid = ""; //record click on the checkbox id / /gridviewid for the Id function singlecheck of the incoming GridView ( Divgridview, selectcheckbox) { //console.info (Divgridview); // Console.info (Selectcheckbox); // Determine whether consecutive clicks of the same checkbox if ( Precheckboxid == selectcheckbox) { ClickCount += 1; } else { precheckboxid = SelectCheckBox.id; ClickCount = 0; } //find the divid containing the checkbox var GridViewList = document.getElementById (Divgridview); / /Get more input var objs = in divID gridviewlist.getelementsbytagname ("input"); for (var i = 0; i < objs.length; i++) { if (Objs[i].type.tolowercase () == " CheckBox ") { objs[i].checked = false; } var SelectCheckBoxId = SelectCheckBox.id; // CheckBox is selected if the number of clicked checkboxes is odd, but not selected if (clickcount % 2 != 1) { document.getElementById (SELECTCHECKBOXID) .checked = true; } else { document.getelementbyid (SELECTCHECKBOXID) .checked = false; } } }
C # GridView CheckBox implements a single selection