Reputation: 1036
In the early days of .NET, you had no choice. Your entire page content was wrapped in a single form tag and you made it work. Somewhere along the way, we started moving away from that, however where I read it eludes me. I recall reading that the new standard is not to put a single form tag in your master page and instead place the form tag in each usercontrol that needed it.
This worked well for me up until recently. I've now created a usercontrol that works fine if the form tag is in the Master page, but if the form control is in the usercontrol, when the form postsback, none of the controls retain their preselected values (i.e. my dropdownlist selection).
Should I go back to placing my form control in the Master page and strip the form tag out of all of my usercontrols? Or did I read correctly and the new recommendation is to put form tags in usercontrols?
Upvotes: 0
Views: 67
Reputation: 1236
If you are using ASP.NET web forms you should have the form tag in the master page.
See this link: http://msdn.microsoft.com/en-us/library/fb3w5b53%28v=vs.100%29.aspx
From this article:
Upvotes: 1