views:

207

answers:

4

It doesn't remove everything inside the 2nd form tag but just hides the and tags from the page

Any ideas and workaround?

A: 

The reason ASP.NET encloses everything in a single form is so that when a postback occurs, the whole form is posted back to the server and you will have access over every element that is on the page.

That is you are able to modify the properties of elements (myTextbox.Text = 'Hello';) from the Code-Behind.

Andreas Grech
+1  A: 

You cant have nested form tags. Either move to asp.net mvc if you want more control over the markup or consider not using asp.net server controls, this way you can include multiple form tags without having to ensure the controls are within a form tag with the runat server attribute but then you dont get the granular access in the code behind and have to start using the request.form colelction to retrieve the postback values.

redsquare
+1  A: 

Nesting of forms is not allowed in html. So you cant add another form inside the server-form.

But it is perfectly legal in ASP.NET to add get-forms outside of the server form.

+1  A: 

I moved the nested form outside to solve this issue.

Zubair Ahmed