문제

I am not new to ASP.net. Actually, I am not even learning it. But, I was recently evaluating some Web sites and saw that awful <form runat="server" ..> that wraps the whole page and contains all other tags. The question: Is that valid HTML? It is 2012 and talks about semantic Web, accessible Web, etc. is hot. What do you think of it?

도움이 되었습니까?

해결책

It is syntax-wise valid HTML. But I agree it's a bit 'outdated' a form and some hidden fields, etc. as ViewState. Also it can be quite cumbersome to work when you want to use more forms on the page (using JQuery f.i.).

Take a look at ASP.Net MVC, it solves the problem. You have full control over the HTML and does not need a form tag around the page. It does not use asp.net server controls.

다른 팁

The the HTML5 specification isn't too restrictive and allows most elements to nest within a form, but does state

The form element represents a collection of form-associated elements, some of which can represent editable values that can be submitted to a server for processing.

So it would seem to me that if the element isn't form-associated, it shouldn't really be there.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top