日期:2014-05-18  浏览次数:20420 次

如何在目标页面接收post传值
有两个页面,a.aspx和b.aspx
a.aspx的代码
<form   method= "post "   action= "b.aspx "   id= "form1 ">
        <div>
                <input   id= "Text1 "   type= "text "   />
                <input   id= "Submit1 "   type= "submit "   value= "submit "   />
        </div>
</form>

请问如何在b.aspx中接收a.aspx中Text1的值?

------解决方案--------------------
<input id= "Text1 " name= "text1 " type= "text " />
得加name的
2.aspx
Request[ "text1 "]

------解决方案--------------------
a.aspx
<asp:Button ID= "Button1 " runat= "server " OnClick= "Button1_Click1 " Text= "Button " PostBackUrl= "~/SearchCount/Default2.aspx " />
b.aspx
protected void Page_Load(object sender, EventArgs e)
{
Label lb = (Label)PreviousPage.FindControl( "Label1 ");
Label1.Text = lb.Text;
}

vs2005下使用,不清楚vs2003下能不能使用
------解决方案--------------------
Response.Redirect(b.aspx?ID= "+ text1.Value + " ")

request[ "text1 "]

------解决方案--------------------
<%=Request[ "text1 "].ToString()%>
------解决方案--------------------
Request[ "参数值 "]
------解决方案--------------------
一样呀
用 request[ "id 名 "]就可。
另外也可以 将 那个 input 设为服务器控件
<input id= "Text1 " type= "text " runat= "server "/>
则在后台代码中直接引用 Text1.text而获得
------解决方案--------------------
this.Request.Form[ "Text1 "].ToString();
------解决方案--------------------
this.Request.QueryString[ "ID "].ToString();//获取查询字符串的值

this.Request.Form[ "ID "].ToString();//获取Post的值
------解决方案--------------------
楼上的标准答案