Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Using Enter to submit form


Message #1 by soltisa@W... on Fri, 14 Feb 2003 13:45:58 -0700
Does anyone know the code to submit a form when you hit enter?  What I have
is a form with one text box and one submit button. I am also using code
behind.

Alvin Soltis
PCS Center Technology
"The less you have, the less you have to worry about"

Message #2 by "Tim Musschoot" <Tim.Musschoot@a...> on Fri, 14 Feb 2003 22:09:07 +0100
Make sure the button is an asp:button.  Catch the "OnClick" event.

Example
In .aspx file:

<asp:Button id="LoginButton" runat="server" AlternateText="Login"
ImageUrl="images/login.gif"></asp:Button>


In .cs file:

protected System.Web.UI.WebControls.Button LoginButton;


private void InitializeComponent()
{    
	this.LoginButton.Click += new
System.Web.UI.ImageClickEventHandler(this.LoginButton_Click);
}


public void LoginButton_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
	// do stuff
}


HTH,
Tim Musschoot
Software Engineer
AspNL Moderation Team
TimMusschoot@a...
http://www.aspalliance.com/timmusschoot
 



-----Oorspronkelijk bericht-----
Van: soltisa@W... [mailto:soltisa@W...] 
Verzonden: vrijdag 14 februari 2003 21:46
Aan: aspx_beginners
Onderwerp: [aspx_beginners] Using Enter to submit form


Does anyone know the code to submit a form when you hit enter?  What I have
is a form with one text box and one submit button. I am also using code
behind.

Alvin Soltis
PCS Center Technology
"The less you have, the less you have to worry about"


---
[This E-mail scanned for viruses by Declude Virus]



  Return to Index