62,046
社区成员
发帖
与我相关
我的任务
分享
public string GetStr()
{
StringBuilder sBulid = new StringBuilder();
sBulid.Append(@"<select id=""select18"" name=""select"">
<option value=""男"">男 </option >
<option value=""女"">女 </option > //去掉一个也没问题。
</select > ");
return sBulid.ToString();
}
protected void test_Click(object sender, EventArgs e)
{
if (Request.Form["select"] != null)
{
string s = Request.Form["select"];
Response.Write(s);
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function test()
{
var el = document.getElementById("sel");
document.getElementById("hitest").value = el.options[el.selectedIndex].value;
alert(document.getElementById("hitest").value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<select id="sel" onchange="test()" Style="margin:-2px;width:40px;background-color: #CCCCCC;" size="1" >
<option value="男"> 男 </option >
<option value="女">女 </option >
</select >
<input type="hidden" id="hitest" runat="server"/> </form>
</body>
</html>
1.Request.Form["select111"]
2.如何在C#中实现asp中如下的功能:
Request.Form(element).count
C#中Request.Form[element]是一个字符串
有没有替代方法?
---------------------------------------
System.Collections.Specialized.NameValueCollection nvc=Request.Form;
int i=nvc.Count;