vb.net code works on IE but not on chrome or Firefox
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
开发者_StackOverflow ReportError(ex, Session, Request)
End Try
End Sub
How can i make this work on different browsers?
Try
Form.DefaultButton = ButContinue.ClientID
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.
- http://weblogs.asp.net/efrancobisi/archive/2007/03/15/panel-s-defaultbutton-whims-not-every-ibuttoncontrol-is-the-same.aspx
- http://bytes.com/topic/asp-net/answers/453148-asp-net-2-0-multiple-problems-defaultbutton
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>
精彩评论