有多个表单,接收页如何得到表单的名称呢?
解决方案 »
- 这分要赚很容易
- asp页面怎么遍历list中的多个实体的属性值
- [AjaxPro.AjaxMethod]调用问题
- access转mssql问题
- [60分]存储过程分页,产品列表,需要满足下列条件?
- 怎么提取字符串某一段啊??????老大们
- 请问javascript能否清空asp.net中的session,如果不能那么用什么呢?是否可以调用asp.net中的函数来清空服务器端的session
- 请问如何在asp.net(c#)中创建自己的命名空间
- datasetcommand说的是不是dataadapter
- vs 2012 项目文件多,没分层,修改操作等很卡
- .net中按钮如何更改iframe的src
- 请问在vb.net开发web程序,如何分割窗体
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<form id="form1" name="form1" method="post" action="get.aspx">
</form>
<form id="form2" name="form2" method="post" action="">
<p> </p>
</form>
<form id="form3" name="form3" method="post" action="">
</form>
<p> </p>
</body>
</html>以上有三个表单,提交其中一个后,get.aspx得到表名称“form1”或ID。
把FORM的名字直接写到Hidden的value里,不就能获取到了吗
能得到当前提交表单的名称么?就是POST的啊。但我要得到名称,不是表单中的内容。
<form id="form1" action="b.php" method="post">
<fieldset>
<legend>basic information</legend>
请输入姓名: <input type="text" name="name" /><br />
请输入密码: <input type="text" name="password" /><br />
<input type="hidden" name="whichform" value="form1" />
<input type="submit" value="提交" />
</fieldset>
</form>
<form id="form2" action="b.php" method="post">
<fieldset>
<legend>detail information A</legend>
请输入姓名: <input type="text" name="name1" /><br />
请输入密码: <input type="text" name="password1" /><br />
<input type="hidden" name="whichform" value="form2" />
<input type="submit" value="提交" /></fieldset>
</form>
<form id="form1" action="b.php" method="post">
<fieldset>
<legend>basic information</legend>
请输入姓名: <input type="text" name="name" /><br />
请输入密码: <input type="text" name="password" /><br />
<input type="hidden" name="whichform" value="" />
<input type="submit" value="提交" onclick="javascript:whichform.value=this.form.id" />
</fieldset>
</form>
if (request.RequestType == "POST")
{
writer.WriteLine("<table border=1><tr><td>名称</td><td>值</td></tr>");
foreach (string o in request.Form.Keys)
writer.WriteLine(string.Format("<tr><td>{0}</td><td>{1}</td></tr>", o, request.Form[o]));
writer.WriteLine("</table>");
}
SP1234有礼!见到你真高兴!Javascript可以在本页中得到,但是那个get.aspx 中的编程如何得到呢?
每个表单都安排好ID和name了...
如 <input type=hidden name="formname" value="表单名字">然后 string xxx=request["formname"];
formname是指隐藏控件.它的值就是当前提交form的名字.
<form name="tom">
<input type=hidden name="formname" id="formname" value="tom">
</form><form name="tony">
<input type=hidden name="formname" id="formname" value="tony">
</form>如果提交的是第二个,
string xxx=request["formname"];
XXX的值会是"tony"