In our last episode I was adding a single textbox field to a site home page which I wanted to have as high-utility as possible, so I added a prompt in the textbox with clear-onfocus support. I added a “GO” button then thought that if I really wanted to make the field useful, I'd add a default action for the button so the user could click the ENTER key without negotiating the mouse to click on the “GO.”
I knew Andy Smith had done some good work in this area, but I was hoping for a simpler, non-dll solution, and dang if I didn't find an amazing simple solution to add default ENTER support for an ASP.NET form.
Just add the following on the .ASPX form:
<INPUT id=test1 style="WIDTH: 0px; HEIGHT: 0px" size=1 value=1 name=test1>
That did it. It was like the good old days when web pages had a default ENTER action by default. I assume there may be situations when adding this goofy INPUT tag doesn't work, but it definitely did the trick for me today!