a.aspx页面 通过action="default2.aspx"转到b.aspx

a.aspx页面代码:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   
<title>无标题页</title>
</head>
<body>
   
<form id="form1" method="post"  action="b.aspx">
   
<div>
   
<input id="t1" name="t1" type="text" />
   
<input id="Button1" type="submit" value="button"/>
   
</div>
   
</form>
</body>
</html>

b.aspx后台代码:

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(Request.Form[
"t1"]);
    }

注意:

1.不要用服务器端Form方式。如果加上runat="Server"则不能正常运行!
2.input里面必须加上name和id两个属性,否则取不到值。
3.Request.Form接的是方括号“[]”而不是圆括号“()”。

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-05
  • 2021-09-22
  • 2022-12-23
  • 2022-01-19
  • 2021-09-21
  • 2022-01-19
相关资源
相似解决方案