取不到表单提交的东西,为什么?

来源:百度知道 编辑:UC知道 时间:2024/06/20 08:52:42
以下表单提交后取不到PostTypeId1的值,而在地址栏输入"hmx_search.aspx?PostTypeId1=文员"却可以取得,为什么?
--------------------------------------------------------
<form id="form1" name="form1" method="post" action="hmx_search.aspx">
<label>PostTypeId1
<input name="PostTypeId1" type="text" id="PostTypeId1" />
</label>
<input type="submit" name="Submit" value="提交" />
</form>
用GET方式可以了,不过为什么?
public string QS(string name)
{
return Request.QueryString[name] + "";
}
this.QS("postTypeId1")
------------------------------另一个问题,我可以这样改吗?让name和PostTypeId1一块提交
<form id="form1" name="form1" method="post" action="hmx_search.aspx?name=aa">

用GET方式提交

有报错吗?

取值方式错了 应该用 Request.Form["PostTypeId1"];
PostTypeId1为控件name属性 必须post提交

gpice

说的对着的!

你用的post方式提交,必须用:request.form来接受!

如果是get方式的话,就用:request.querystring来接受!

也可以用:request[""]直接接受!不过速度受影响!因为它也要判断是那种方式提交的!

你说的挺乱的~~

不过你要一块提交的话,可以在表单里用一个隐藏域呀!隐藏域的值就是name