开发者

Forms in asp.net? [duplicate]

开发者 https://www.devze.com 2022-12-27 06:14 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate:开发者_如何学编程
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

开发者_如何学编程 Multiple forms on ASP.NET page

i have a doubt. can we place more than one form tag in a xxx.aspx page


Yes, you can have multiple forms in a page and can set the action of each form to different pages.

<form name="frm1" action="first.aspx"></form>
<form name="frm2" action="second.aspx"></form>


form tag in a xxx.aspx? It's hard to understand what you're asking.

If you talking about the asp.net form tag, you can have only one per page. If you talking about regular html form tag, you can have how many you want.


You can include as many server-side forms as you need in a Web Forms page, as long as you ensure that no more than one is visible at any time. See: http://msdn.microsoft.com/en-in/magazine/cc164151(en-us).aspx


Can you? yes, should you? maybe not. It really depends on the point of the page and what its doing,

  • are the two forms entirely separate?
  • do they deal with entirely different entities?

if so then yes you could have two separate forms as long as each form is uniquely identified. Alternatively you could look at having two separate user controls which carry out the required functionality within the one ASPNET form.


You cannot have multiple server side form tags. you can use one server side form and multiple html forms in the same page.

In ASP.NET, one page is allowed to contain one form with runat="server" property. Thus, it's impossible to contain multiple server forms in one page.

0

精彩评论

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