简体   繁体   English

如何在ASP.NET Page_Load上发送表单

[英]How to send form on ASP.NET Page_Load

i have a send post page A like this: 我有一个这样的发送帖子页面:

<body>
<form name="main" action="testReceiveOrder.aspx" method="post" >
    <input type="hidden" id="rqXML" name="rqXML" value="123"/>
</form>
</body>

And another page B.cs to get post: 另一个页面B.cs进行发布:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!IsPostBack)
            {
                if (Request.Params["rqXML"] != null)
                {
                    Response.Write(Request.Params["rqXML"]);
                    Response.End();
                }
            }
        }
    }

But i don't know how to trigger post in page A.cs Page_Load ? 但是我不知道如何在A.cs Page_Load页面中触发帖子?

In page A.cs Page_Load i want to get some data and make a xml put into value then send this form. 在A.cs Page_Load页中,我想获取一些数据并在xml中添加值,然后发送此表单。

Can you please tell me how to do this? 你能告诉我该怎么做吗?

Thanks. 谢谢。

Just do something like this: 只是做这样的事情:

if(!Request.QueryString["rqXML"].IsEmpty() ) {
     // Do something here
}

then if there is a value, just do what you need with it.... IsPostBack should be used only when you are processing an "action" after Loading it AFTER the first time.... 那么,如果有一个值,就用它来做就可以了。...IsPostBack仅在第一次加载后处理“动作”时才使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM