开发者

Why do nested forms in Asp.net mvc not have scope?

I have form that has several forms inside of it in asp.net mvc. The nested forms are using ajax helpers and are ajax forms.

The forms that are nested ALWAYS post to the original form's action, not their action.

Why? Why can't开发者_运维问答 I have multiple forms on one page?


You can have as many forms you like on a page, but you can't nest them.

It has nothing to do with ASP.NET or MVC, it's the HTML form tag that doesn't allow nesting. If you try to nest forms, the browser will ignore the inner form start tag.


Even from the point of view of ASP.Net alone, only one form with a runat="server" attribute can be used within a web page. Otherwise, a run-time error will pop out halting the page creating process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜