Multi form on the page

Posted on 2005-05-16
Medium Priority
Last Modified: 2010-04-07
I would like to know what is the best way to have multiple forms on the page, I know we can only have one server side form, but I need to have one for a search, one for a login.

The problem is that I have one form on the top of the page, and the other is on the botton of the page., So what should I do, since I'm using tables to do the layout, I get my page all wrong, so can I open the form before I start my table?? or any other solution?
Question by:Ennio

Accepted Solution

BurntSky earned 800 total points
ID: 14015709
You've asked about this at least twice already (I've answered them both, too).  I copy and pasted my response for you below.  You are correct in that there can only be one server-side form.  As far as I'm aware you could put any number of non-server-side forms on an ASP.NET page, but it would totally defeat the purpose of even using ASP.NET because it would eliminate the entire "postback" model.

You can't have more than one Form in ASP.NET applications (one of the many changes from ASP 3).  But this doesn't mean you can't do what you're asking.

Attach an event handler to your "search" and "login" button's click events.

private void Page_Load(object sender, System.EventArgs e)
     this.btnSearch.Click += new EventHandler(btnSearch_Click);
     this.btnLogin.Click += new EventHandler(btnLogin_Click);

private void btnSearch_Click(object sender, EventArgs e)
     // Code to handle search here

private void btnLogin_Click(object sender, EventArgs e)
     // Code to handle login here

Assisted Solution

caball88 earned 800 total points
ID: 14015784
LVL 25

Assisted Solution

apeter earned 400 total points
ID: 14017575
   U have put mulitple forms in different IFrames Tag....so only the Corresponding Frame page will be refreshed and others remail same. So One IFrame Tag u can have ur loging and in another u can have ur Search etc


Author Comment

ID: 14017714
BurntSky  doing in your way, I get this error msg.

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30408: Method 'Public Sub call_lalaal(s As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub ImageClickEventHandler(sender As Object, e As System.Web.UI.ImageClickEventArgs)'.

So I create one IFrame for each form I need, and do I need to do something else? any command, I need to type?

Author Comment

ID: 14017854
BurntSky, I got it, I had the wrong events ;)

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question