In ASP, we usually submit a form to another page (accept data page). But in ASP., the server-side form is usually submitted to this page, if I set
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 verification by adding the header on the Accept page (test.aspx)
<%@ 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
Button1. Postbackurl= "Test.aspx";
This will not cause the problem of validation errors, and is very safe.
--------------------------------------------------------------------------------------
By the way, here's how to dynamically modify form form properties Some methods are not related to the above: for example, modify the target property
Normal page:
((System.Web.UI.HtmlControls.HtmlForm) this. FindControl ("Form1")). Target = "_blank";
Or
Form1. attributes["target"] = "_blank";
Master Page master included:
((System.Web.UI.HtmlControls.HtmlForm) this. Master.findcontrol ("Form1")). Target = "_blank";
Front Desk modification:
<asp:button id= "btnsubmit" runat= "Server" text= "button" onclick= "btnSubmit_Click" onclientclick= " this.form.target= ' _blank ' "/>