自动生成静态 checkbox 后台如何获取它的值呢?

来源:百度知道 编辑:UC知道 时间:2024/06/15 07:57:15
for (int i = 0; i < dt.Rows.Count; i++)
{
trtd.Text += "<tr><th style='width: 10%'><input id='Checkbox" + i + "' type='checkbox' /></th></tr>";
upcmd.Parameters["@checkbox"].Value = Request.Form["Checkbox"+i];
}这里出现的错误是Request.Form["Checkbox"+i]的值未提供也就是说他的值为空我怎么才能获取他的值呢》?
trtd.Text += "<tr><th style='width: 10%'><input name='Checkbox" + i + "' type='checkbox' /></th></tr>"; 这样实现了谢谢你

加上name属性就行了 我的测试
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>

<script language="JavaScript" type="text/javascript">
<!--
function b(){
var divC=document.getElementById("divC");
var fsdf=document.createElement("input");
fsdf.type='text';
fsdf.name = "txtA";
fsdf.value="我生成的";
divC.appendChild(fsdf);
}
//-->
</script>

</head>
<body>
<form id="form1" runat="server&