form tag in an aspx



Is it "ok" to use an html form tag in an aspx file? I get strange resaults in IE8. I cant understand what it is.

<form attributes>



Oct 19, 2011 15:18

The word Thanks should be outside the code.

Oct 19, 2011 15:19


You can only have one form tag with the runat="server" attribute on a page, but you can have more form tags outside the form tag with runat="server".

Take a look at this post:

Hope this helps


Oct 19, 2011 20:31

Frederik: Thank you very much. I check it out later, got so much work in between. I'll get back. Take care.

Oct 20, 2011 6:40


Ok. Hmm. My masterpage has one form tag with runat="server". Masterpage also has a contentplaceholder. On other aspx pages I have one asp content that sends to the placeholder, so to speak.

The big mystery is that if I place a form tag in any aspx file, just a plain and simple form tag (no attributes), the layout gets messed up in IE8, it works fine in Firefox and IE compatibility mode. Any idea?

Oct 24, 2011 13:57

Not without seeing the page in question :). Got any link?

Oct 24, 2011 13:59

it is not possible to nestle formtags. As you've experienced, your MasterPage has one gigantic form tag runat server so you can perform logic inside of it. Firefox/Chrome will perhaps render your nestled form code, but if you inspect it you'll see that firefox and chrome strips the form tags before rendering the html. If you want nestled forms you'd need to put it into an iframe as far as I know. 

Oct 25, 2011 11:29

Andreas: Hi, thank you. Hmm, what about those forms that editors can do, how do thet get tackled? They work.

I have heard somewhere that an option is to not write nestled form tags, instead just write code for fields and buttons (including a submit button) and then with code make it so that it gets posted where you want. But I dont know how to do that.

Oct 25, 2011 13:03

What you are referring to is Xforms, technote about it here this will circumvent the nestled formtag problem, usually used by editors. Write forms with controllers is the correct way to go yes.

Oct 25, 2011 13:19

All right, thanks. Well I didnt do an iframe but almost, same principle, just a new window, a static html page. Ok, I think I start a new thread in the future if I want to do another form then, or maybe read up on it.

But I now know I cant nest form tags, so its good to get that confirmed.

Thank you both. Sorry I didnt have time to give you a link Frederik. Here at work I had things on a development server not public, and at home I run localhost throught Visual Studio only.

Oct 25, 2011 13:25
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.