根据值绑定checkbox是否被选中:
<%#DataBinder.Eval(Container.DataItem, "IsDistribution ").ToString() == "True" ? " <input name='m' type='checkbox' id='checkbox' checked='checked' />" : "<input name='m' type='checkbox' id='checkbox'/>"%>
checkbox提交时注意:没被选中是不会提交后台的,没写value默认提交的是"on",input的checkbox只有checked='checked'
(
没有true or false,true or false 是<asp:checkbox>)
对于绑定checkBox的没有ID的值,示例代码:
$("input[type='checkbox']").each(function(i) {
if ($(this).attr("checked") == true) {
$(this).attr("value", i);
}
if ($(this).attr("checked") == true) {
$(this).attr("value", i);
}
游标
i作为标记的ID
后台获取:
string[] c=request.params["checkbox"].split(',');
string [] name=request.params["name"].split(',');
而选中的当前行的其他值是:
name[c[i]]