开发者

How to nest a form in an ASP.NET page (which has a form wrapped around it)

I am wr开发者_StackOverflow社区iting 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


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.


<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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜