ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
How Can we use multiple forms in single asp.net application?
 Question Submitted By :: Muralisivam
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How Can we use multiple forms in single asp.net application?
Answer
# 1
ASP.NET pages can contain no more than one HTML form and 
can post only to itself, but you can work around this 
limitation to add extra input forms



How can I use multiple HTML forms in an ASP.NET 
application? How can I build a page to make it contain a 
small form in a corner for users to login or start a 
search? These are frequently asked questions from those who 
do serious ASP.NET development. The problem arises from the 
fact that ASP.NET forces a single-form programming model. 
In HTML, the form is the construct designed to gather some 
input data and post it to the server for further 
processing. The form is seen as a collection of <input> 
tags such as textboxes, drop-down lists, and checkboxes, 
whose contents are automatically collected and posted when 
a submit button is pressed. Likewise, the same finalizing 
process can be started via script. In HTML, you can have as 
many forms as you like in each and every HTML page. This 
structure has been maintained in Active Server Pages (ASP), 
mostly because ASP is a sort of wrapper built around the 
HTML page. In the end, with ASP you create the page 
structure from an HTML basement with some opened windows of 
dynamically generated markup. 

ASP.NET is quite different and qualifies as a true runtime 
environment that enforces its own programming rules to 
generate the same kind of output—HTML markup. In doing so, 
ASP.NET mandates that, at most, one form is supported, and 
any submissions the web server can receive from a page 
should target the same original URL. In short, each ASP.NET 
page can contain no more than one HTML form and can post 
only to itself. 

There are many benefits to the ASP.NET programming model 
out of this pattern, the most important of which is the 
ability to handle postback events on top of a stateful 
architecture. In ASP, how did you manage to maintain the 
state of input elements across two successive requests for 
the same page? Should I say it? I guess you were forcing 
the action attribute of the HTML form to the same URL of 
the current page and using some code blocks and the session 
state to restore key attributes on input fields. At its 
core, this is just what ASP.NET does, except that it uses 
viewstate instead of session state and that it promotes the 
model to rank of a “mandatory” rather than “optional” 
feature. 

In summary, to be able to use ASP.NET server controls for 
capturing some user input, you have to use the ASP.NET 
server form control. In doing so, you lose the power of 
controlling the action attribute of the form and are 
limited to, at most, one form per page.

Hence the initial question, how can you insert a second 
form in an ASP.NET page? 

If your goal is “changing” the form from time to time, 
obeying different runtime conditions, then be aware that 
the enforced rule states that only one form can be visible 
at any time. So you can place as many as <form 
runat=server> tags as needed in a page, as long as only one 
of them is marked with visible=true. By acting on the 
visible attribute, you can programmatically switch from one 
form to the next. 

If your goal is having a “child” form for login or search 
purposes, the solution is even simpler: Stick to classic 
HTML forms; that is, <form> tags devoid of the runat 
attribute. ASP.NET doesn’t exercise any control on tags not 
marked with the runat attribute and you’re just fine until 
HTML supports multiple forms. What do you lose in the 
change? The ability of using postbacks in the target page 
of the login or search. Just use the ASP classic 
programming model—the Request object—and you’re all set.
 
Is This Answer Correct ?    4 Yes 1 No
Isha
 
  Re: How Can we use multiple forms in single asp.net application?
Answer
# 2
Yes we can do it
 
Is This Answer Correct ?    3 Yes 1 No
Narendra
 
 
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
Why does a user need nothing more than a Web browser to view ASP.NET pages?  1
Guys can anobody tell what is Conditional Bloating in asp.net ??  1
What ASP.NET object encapsulates the state of the client and the browser? a) The Session object b) The Application object c) The Response object d) The Request object e) The Server object Syntax-Softtech3
How to Open any web page by clicking any Any ASPControl like (Checkbox,radio button or Button) without calling its event and without going to Siverside code? LG-Soft1
I have one .Net application and i have two databases which is in SQL server2000 and one more database in ORACLE? how can i access the database from different Databases? eXensys3
what do you mean software devlopment ? HCL6
You are using the try? catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? SqlConnection cn =new sqlConnection(strSQL); SqlDataSet ds; try { cn.open(); //perform the data processing steps ??.. } catch (OleDbException e) { ?.. } a) The exception class is wrong; it should be sqlErrors. b) The exception class is wrong; it should be sqlSyntaxExceptios. c) The exception class is wrong; it should be sqlExceptions. d) The exception class is wrong; it should be sqlExcptions. Syntax-Softtech2
Which of the following hosts Can't be used to create .net Application? a) IIS b) Internet Explorer c) ASP.Net d) Windows Shell Which one is correct? CTS1
which directive is mandatory in page control AG-Technologies3
public key? Microsoft1
what are the ways to improve performance in .net application? Mind-Tree3
When is the ViewState available during the page processing cycle ?  3
How many time you can fill dataset in asp.net? Syntel1
Explain what a diffgram is, and a good use for one?  2
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?  1
What is the transport protocol you use to call a Web service?  2
State management in asp.net ? Accenture5
Which is the namespace used to write error message in event Log File?  1
Which template must you provide, in order to display data in a Repeater control? Wipro2
Hi , I am Basha. I am searching a job in dotnet.Plz tell me the order of page events in asp.net 2.0> plz send faq's related to c#.net,asp.net,sqlserver2000 etc. to my mail-id : bashask.ss@gmail.com Sapient4
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com