Multiple forms in ASP.NET

I understand that ASP.NET is only intended to support one form . What I am confused about is what is the appropriate method for encoding several β€œforms” on a .NET page (I have a login form at the top of the page, via Site.Master and other forms will appear on any page) Should I answer differently? In fact, this does not make much sense. I would appreciate it if anyone could clarify the situation. Thank.

PS I am currently developing .NET 2.0, although I plan to upgrade to .NET 3.5 soon.

+3
source share
4 answers

Almost all ASP.NET web forms return to the same page. If you are not working on some weird outlier (which your question does not indicate), you simply use one form tag around the entire document and use event bindings to your controls to handle various instances.

For example, you may have three buttons that act as submit buttons, one for each "form", but everything inside this tag form, and each of them triggers a corresponding event. This behavior is standard and is handled by ASP.NET for you; all you have to do is write event handlers and bind them.

+5
source

I'm not sure what you mean by the login form. Are you doing some special ajax stuff?

"", , .

http://www.asp101.com/lessons/usercontrols.asp

aspx, , .

+1

, login.aspx. .

0

, webforms (MVC, , ).

, " ". , , click . , aspx , response.redirect - .

0

Source: https://habr.com/ru/post/1734130/


All Articles