Asp. NET form post to other pages method sharing

Source: Internet
Author: User
Tags form post

  This article mainly introduces the method of ASP.net form post to other pages in the paper, the friends who need it can refer to the following

In ASP, we usually submit the form to another page (accept the data page). However, in ASP.net, service-side forms are usually submitted to this page, if I set     code as follows: form1.action= "Test.aspx";   The error of the view validation error is caused by the ASP.net security mechanism. We can also turn off this validation, in the Accept page (test.aspx) header plus   code as follows:  <%@ page enableviewstatemac= "false"%>   but this is not very safe, In fact ASP.net 2.0 also provides a way to submit to other pages, the server button controls provide a property: PostBackUrl, so write   code as follows: Button1. Postbackurl= "Test.aspx";   This will not cause the problem of validation errors, but also very safe.  --------------------------------------------------------------------------------------  Here, by the way, how to dynamically modify form form properties Some methods are not related to the above: for example, modify target properties   Normal pages:   Code as follows: ((System.Web.UI.HtmlControls.HtmlForm) this . FindControl ("Form1")). Target = "_blank";   or   code as follows: Form1. attributes["target"] = "_blank";   contains master page master:   Code is as follows: (System.Web.UI.HtmlControls.HtmlForm) this. Master.findcontrol ("Form1")). Target = "_blank";   Foreground modification:   Code as follows: <asp:button id= "btnsubmit" runat= "Server" text= "button" onclick= "btnSubmit_Click" onclientclick= "this.form.target= ' _blank '"/> &nbsp
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.