Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a page can have only one server-side form tag

Tags:

I am using master page and when I run this page, it shows the following error message:

a page can have only one server-side form tag

How can I solve this problem?

like image 851
Manoj Wadhwani Avatar asked May 26 '10 07:05

Manoj Wadhwani


People also ask

How do you solve this a page can have only one server side form tag?

Solution 1 The reason for this error is that your having more than one FORM tag in your aspx page with run at server attribute, which ASP.Net does not allow. You can have only one form tag in your aspx page with run at server attribute. So keep only one form tag in user aspx page to avoid this error.

Can we have two form tag in ASPX page?

In ASP.NET MVC you can implement as many forms as you want (and it is valid & correct behavior of web pages). The reason all server controls are placed inside <form> tag is to allow the WebForms engine to recognize them, load their values & save their values from/to the ViewState.


2 Answers

I think you did like this:

<asp:Content ID="Content2" ContentPlaceHolderID="MasterContent" runat="server">   <form id="form1" runat="server">   </form> </asp:Content> 

The form tag isn't needed. because you already have the same tag in the master page.

So you just remove that and it should be working.

like image 106
Naveen Desosha Avatar answered Oct 13 '22 00:10

Naveen Desosha


It sounds like you have a form tag in a Master Page and in the Page that is throwing the error.

You can have only one.

like image 34
philiphobgen Avatar answered Oct 12 '22 23:10

philiphobgen