I have an Onclientclick event attached to a button in the server code, as shown below,
TopPanelButton.OnClientClick = string.Format("if(!ValidData({0},{1},{2},{3})) return false;", txtOD.ClientID, radCmbOD.ClientID, txtgetMe.ClientID, RadAjaxLoadingPanel1.ClientID);
In addition, the onClick event is attached for the same button on the aspx page,
<asp:Button ID="TopPanelButton" runat="server" Text="Go" CssClass="CBtn1" Width="30px" Height="21px" OnClick="TopPanelButton_Click" />
A server click event should fire if onclientclick returns true. The ValidateData () function is called to validate the records in the form.
This code works fine in IE. But in Firefox, both events are not firig. If I comment on the code "TopPanelButton.OnClientClick = ...", then the onClick event occurs.
Where can I apply this Page.ClientScript.GetPostBackEventReference () code in my code below.
TopPanelButton.OnClientClick = string.Format("if(!ValidData({0},{1},{2},{3})) return false;", txtOD.ClientID, radCmbOD.ClientID, txtgetMe.ClientID, RadAjaxLoadingPanel1.ClientID);
Firefox does not call the ValidData function. I place a warning inside javascript, but the warning message does not appear in Firefox. But IE shows a warning message.
My validData function:
function ValidData(txtOND, ddlOND, txtgetMe, aPanel) { alert("Entered"); if (!ValidNumber(txtgetMe)) { aPanel.hide(); return false; } if (ddlOND.value == "Origin" || ddlOND.value == "Destination") { if (!ValidOriginOrDestination(txtOND, ddlOND.value)) { aPanel.hide(); return false; } } else if (ddlOND.value == "O&D") { if (!ValidOND(txtOND)) { aPanel.hide(); return false; } } if (ddlOND.value == "Region Starting with" || ddlOND.value == "Country Starting with" || ddlOND.value == "Budget Station Starting with") { if (txtOND.value.length == 0) { radalert("Enter a value for " + ddlOND.value); aPanel.hide(); return; } } aPanel.show(); return true; }