tags:

views:

39

answers:

2

I am writing HTML to an ASP.NET page (from a web service response), and the HTML has <form> tags. Unfortunately, because the ASP.NET page already has a wrapped around it, a lot of the buttons on the page break. Does anyone know how I can nest the form inside the ASP.NET page without breaking the top-level form?

Note: the HTML I am bringing in is a form with a bunch of hidden fields inside of it, and it has to be placed within the ASP.NET page, and thus nested in the top-level form.

Thanks

A: 

<form> tags are not allowed to nest inside <form> tags. Depending on the effect you're interested in, you could put the extra <form> outside the ASP.Net one, and use absolute positioning to put it where you want in the page.

DDaviesBrackett
The problem is that I am using SharePoint, and need it to show up right there in the web part.
Josh
+1  A: 

ASP.Net webforms does not allow form tags within it's main runat="server" form. You just can't do it. To work around this, you have three options:

  • Have your extra from completely outside of the main runat="server" form, and don't do use any server-side controls or components with that form.
  • Completely switch over to ASP.Net MVC, which likely means a re-write of anything else you've done for this site
  • Parse and adapt the html from the web service to work within your ASP.Net form.
Joel Coehoorn
Ok, so the form only has hidden input fields... Is there another tag I can use instead of <form>? I'm working in SharePoint, so I'm forced to over lay the <form> inside the top-level form (and can't do MVC for the same reason - wish I could!).
Josh