ASP. Form forms in NET cannot be nested

  • 2021-07-02 23:56:04
  • OfStack

I am very sure that there can be multiple form forms in ASP. I used to do this. In the background classification management page, I put the addition and modification on the same page, which requires two form forms for submission server code processing.

After testing, it is also possible to have multiple form forms on one page in ASP. NET, such as the following code:


<form id="form1"></form><form id="form2"></form><form id="form3"></form>

However, form forms cannot be nested, for example, the following code is wrong:


<form id="form1"><form id="form2"></form></form>

Another point to note is that in ASP. NET, when there are multiple form forms in the page, only one form is allowed to have runat= "server" attribute, otherwise an exception will be generated. This is a few ASP. NET programming entry children's shoes often make mistakes!

This site believes that in the programming mode of ASP. NET, it is rare for two or more form forms to appear on one page. The function of submitting to the server code can be done through an outermost form form, so there is no need to do so much, which is the difference between ASP. NET and ASP!

I hope everyone can remember this one point!


Related articles: