Return key page redirect

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
4/16/2008 8:23:26 AM
Total Posts 12

Return key page redirect

Hi Jo,


Using v2239 on Windows.


I've written a custom module that uses a textbox to do a search.

If you hit the 'return' key instead of clickng the search button the page redirects to to 'SearchResults.aspx'.


Any idea how I can disable this?





4/16/2008 9:43:27 AM
Total Posts 18439

Re: Return key page redirect

Since this question is about a custom module it would have been better to post in the developer forum.

The answer to the question is that the enter key naturally is the same as clicking a button. In ASP.NET you have some control over it. If the button is contained inside an <asp:Panel and you set DefaultButton to the id of the button like this <asp:Panel id="pnlFoo" runat="server" DefaultButton="btnFoo" ...

Then the enter key will only click the button if the focus is within that panel like if the user clicked anything in the panel or put the cursor in a textbox within the panel then the enter key will be equivalent to clicking the button but if niether of these conditions is met the enter key will not click the button.

Hope it helps,


You must sign in to post in the forums. This thread is closed to new posts.