Easy solution for default button
There is a free component that allows you to assign a button to the “enter-pressed” client side event of input controls. If you type some text in textbox and press Enter, the form will postback, and the serverside click event of your button is fired. You don’t need to write any code, but you only need to use this control’s “DefaultButton” property. It you are a beginner programmer this could be a life saver. More about MetaBuilders DefaultButtons Control you can find at http://www.metabuilders.com/Tools/DefaultButtons.aspx
Default buttons in ASP.NET 2.0 and ASP.NET 3.5
ASP.NET 2.0 makes this problems easier and introduce a concept of a “default button”. New defaultbutton attribute can be used with <form> or <asp:panel> control. What button will be “clicked” depends of where actually cursor is and what button is chosen as a default button for form or a panel.
Here is sample HTML code that contains one form and one panel control:
<form defaultbutton=”button1″ runat=”server”>
<asp:textbox id=”textbox1″ runat=”server”/>
<asp:textbox id=”textbox2″ runat=”server”/>
<asp:button id=”button1″ text=”Button1″ runat=”server”/>
<asp:panel defaultbutton=”button2″ runat=”server”>
<asp:textbox id=”textbox3″ runat=”server”/>
<asp:button id=”button2″ runat=”server”/>
ASP.NET Tutorials: Enter Key in ASP.NET – Complete Research
Yura has compiled this excellent resources of performance tuning. Mostly for ASP.NET though.
25 Resources for Tuning Your .NET Application Performance | Effectize
Of particular interest to ASP.NET developers, though, is that when creating an ASP.NET Web Form hitting Enter to submit the form seemingly sometimes causes the page’s Button Web control’s
Click event to fire, and other times not. In this short article we’ll see under what conditions a Button Web control’s
Click event might not fire when the user submits the page hitting Enter; furthermore, we’ll look at a workaround. Read on to learn more!
Via ASP.NET.4GuysFromRolla.com: Enter and the Button Click Event
The one that I’ve used and highly recommend is UrlRewriting.net. (There is another one – also free – called UrlRewriter.net but one that I’ve had not too great experiences with.)
To get UrlRewriting.net to work, simply Add Reference the provided DLL into the ASP.NET Visual Studion Project. Next edit Web.config and make changes on the
<configSections>, <system.web>, <system.webServer>, finally create a new section, <urlrewritingnet> in which you’ll add the “rules” for the rewriting
Also take a look at the article by ScottGu: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx