Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting 2 forms on one page

Status
Not open for further replies.

thehms

Programmer
Jul 3, 2003
58
0
0
AE
hi all...

i want to make a page with a form in the main content of th epage and there will ber a login box on the left side of the page. but when i put 2 forms on the page i get an error telling me that i can only put on form tag with runat=server in it... when i put a normal form as we used to do in classic asp, i cant pass the parameters to the next page, where i should check the username and password. i use the form method as post and on the other page i do a request.form("fieldName") but i cant seem to capture the text...

any help is appreciated..

Regards,
The HMS
 
Each button that you put on a form can have it's own CommandName and CommandArgument properities. Having said that, you could include your login box in the main form and check the username and password if the login button was clicked. Then react accordingly. You kind of have to get the Classic ASP way of doing things out of your head where now you're only using one form and doing all of your postbacks to the same page. What you show or hide under certain conditions is up to you. If you needed this login form functionality on multiple pages the best way to go about it would be to create a User Control and just keep reusing it.
 
i made one form tag in the page and put the web user control inside it. the control has my username and password textboxes and my sign in button...

now i have a weird problem...

whenever i click the signIn button nothing happens... no event is triggered.

i tried making a new blank webform and put the control in it and when i click the button it works..!

i checked all my html and c# code, but nothing seems to be wrong....

did anyone come across something like this before?
 
Always check the InitializeComponent() and make sure your events are wired up.
this.Button1.Command += new System.Web.UI.WebControls.CommandEventHandler(this.Command_ButtonClicked);
VS.NET sometimes blows them away.
Marty
 
yes, it is there:
Code:
this.Button1.Click += new System.EventHandler(this.Button1_Click);

this is the line that i have for th ebutton initialization....

the button does work when i put the control on a new blank webform...
 
what do u mean "inherit the webform"?
i have this line at the beginning of the html code where it declares the user control:

Code:
<%@ Register TagPrefix="uc1" TagName="PortalSignin" Src="controls/PortalSignin.ascx" %>

i compared both my original page with the form that doesnt work and the new one that works and tere is nothing different in both of them... whether in the HTML or the C# code behind.

Thanx,
The HMS
 
hi all...

i got it to work at last :)

i discovered that another user control i have on the page has a <form> tag and that was preventing it from running the button for some reason..!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top