Post ASP.Net Form data to another page

前端 未结 5 965
终归单人心
终归单人心 2020-12-11 17:58

I have an ASP.Net Page, aspx with its default form.

I have a Submit Button for it. Upon clicking, it will post the data to itself. In othe

5条回答
  •  无人及你
    2020-12-11 18:34

    I had a similar issue. I had an asp:button which simply performed a postback. In the Page_Load IsPostBack portion, I did some complex validation. Most people just submit the form to the next page and do validation there, then redirect back if it fails. But I thought was was sloppy. So the solution was postback, then upon validation, submit from within the CodeBehind. I believe that's what you're looking for.

    I'd like to draw this out with "detail", but it's very simple:

    Server.Transfer("~/folder/page.aspx", True)
    

    The "True" is a flag of whether or not to preserve the POST data. Works fine for me, let me know how it works for you.

    http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET

提交回复
热议问题