Post方式传值

发送页:

    <form id="form1"action = "WebForm1.aspx" method ="post">
    <div>
       <input name ="txtname" type ="text" value ="awei" />
       <input type = "submit" value ="提交到WebForm1.aspx" />
    </div>
    </form>

接收页:

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Form["txtname"] != null)
            {
                TextBox1.Text = Request.Form["txtname"];
            }
        }

注意:<form>中不能带runat = "server",否则会不起作用。

posted on 2011-03-14 11:02  云起的自学笔记  阅读(380)  评论(0编辑  收藏  举报

导航