In ASP, we usually submit the form to another page (accept the data page). But in ASP.net, service-side forms are usually submitted to this page, if I set
Copy Code code as follows:
Form1.action= "Test.aspx";
This can cause the view to validate errors due to the ASP.net security mechanism. We can also turn off this validation in the Accept page (test.aspx) with the head Plus
Copy Code 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 control provides a property: PostBackUrl, so write
Copy Code 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, modifying the target property
Normal page:
Copy Code code as follows:
((System.Web.UI.HtmlControls.HtmlForm) this. FindControl ("Form1")). Target = "_blank";
Or
Copy Code code as follows:
Form1. attributes["target"] = "_blank";
Include master Page master:
Copy Code code as follows:
((System.Web.UI.HtmlControls.HtmlForm) this. Master.findcontrol ("Form1")). Target = "_blank";
Front Desk modification:
Copy Code code as follows:
<asp:button id= "btnsubmit" runat= "Server" text= "button" onclick= "btnSubmit_Click" onclientclick= " this.form.target= ' _blank ' "/>