I suggest you ...

support multiple runat="server" forms in Web Forms pages

Allow for Web Forms pages to contain multiple server-side forms rather than just one. This allows for much better accessibility and usability in the pages.

191 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Damian Edwards (MSFT)AdminDamian Edwards (MSFT) (Admin, Microsoft ASP.NET Future Feature Feedback) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Murali MMurali M shared a merged idea: Support more than one asp:form tag in ASP.Net Web Forms  ·   · 

    7 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Murali MMurali M commented  ·   ·  Flag as inappropriate

        As of now we could able to add only one asp:Form in web form. In many scenarios we need to add many. Also it can be placed at any part of the document.

        Current web form design, restrict the form to be placed only on root of the document.

      • thornthorn commented  ·   ·  Flag as inappropriate

        Peter, I know how the current implementation of UpdatePanel works. I'm talking about changing this. Yes, the issue is all about changing the mental model. Do you often care about controls outside the panel? As for me, generally, it's quite a rare case. For example, think of side bar widgets on a blog. Do they often need to know anything about the rest of the page in order to update properly?

      • PeterPeter commented  ·   ·  Flag as inappropriate

        Thorn: The current UpdatePanel relies on there being a single form on the page. When you do a postback from an UpdatePanel all the state is sent back to the server, but only a portion is going back. This is why from an UpdatePanel event handler you can access the state of a web control that is outside the panel.

        I'm not saying there's no way to do this, only that there's no way to do this with the current model. You'd have to take into consideration that some control that's in a different form would not get updated. The current mental model in WebForms apps is that all controls are in sync. With multiple forms you would have to bend that "rule".

      • PeterPeter commented  ·   ·  Flag as inappropriate

        If my understanding of how WebForms works is correct, this feature is not possible. The reason there can only be one form on the page is that the server-side controls need the browser state information (what people typed in the form) in order to rebuild their control state. With multiple forms, only the state within those forms is sent back to the server, so on the server-side the web controls would lose data. As a workaround one would have to rely on Javascript to either do the posting or gather the rest of the state from the other forms on the page for a post; which would defeat the intended purpose.

      • JohnJohn commented  ·   ·  Flag as inappropriate

        Adding this feature to Web Forms would be enormously beneficial in so many ways. It would make a HUGE difference when developing a modular system, such as a CMS. The single runat form restriction, for me, is the single most frustrating thing about Web Forms.

      Feedback and Knowledge Base