简体   繁体   中英

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:

    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 ?

In page A.cs Page_Load i want to get some data and make a xml put into value then send this form.

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....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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