views:

107

answers:

3

I have .net code that works on IE8 but wont work on google chrome or firefox. i have put this code for the user to press Enter instead of clicking the mouse everytime.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Try
        If Not IsPostBack Then
           //-- my code --
            Form.DefaultButton = ButContinue.UniqueID
    Catch ex As Threading.ThreadAbortException
    Catch ex As Exception
        ReportError(ex, Session, Request)
    End Try
End Sub

How can i make this work on different browsers?

A: 

I suspect the problem could be caused by how ASP.Net renders the client script to handle DefaultButton. Below are 2 links that sound similar to your problem and both mention issues with button types (button/link/image) and interaction with validation controls (their client-side script at least). ASP.Net renders different script per browser for these controls/behaviours and on some browsers they conflict.

AUSteve
A: 

If you want the user to be able to press enter to submit a form instead of clicking a submit button, have you considered using a Panel?

<asp:Panel ID="Panel1" runat="server" DefaultButton="btnSubmit">
    <%-- Form elements go here --%>
</asp:Panel>
plenderj
+1  A: 

Try

Form.DefaultButton = ButContinue.ClientID
Joel Etherton
Yes, this has to be implemented with ClientID to work correctly.
Rick Ratayczak