Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

In my application code

I have added 1 button
<asp:button id="btnSave" runat="server" cssclass="Button" accesskey="s" onclientclick="return SaveData()"
="" text="Save">




but it works fine in IE not in google chrome
I am stuck in this Please help me to resolve this

What I have tried:

<asp:Button ID="btnSave" runat="server" CssClass="Button" AccessKey="s" OnClientClick="return SaveData()"
                        Text="Save"/>



Javascript code:
function SaveData()
{
    var sJSON=Main_GetDataSave();
    sJSON='Save^'+sJSON;
    UserDataServerCall(sJSON,'');
    return false;
}
Posted
Updated 10-Aug-19 21:11pm
Comments
Richard Deeming 13-Aug-19 12:58pm    
Any errors in the browser console?

Try using the built-in Javascript debugger[^] to step through your SaveData function to see what happens.
SukirtiShetty 14-Aug-19 2:23am    
I have checked in Javascript debugger and it throws 1 error "Uncaught TypeError: oCtrlTable.getAttribute is not a function"

var oRow,oCtrlTable,iFieldID,oPromptCell;
oRow=oTable.rows[i];
oCtrlTable=oRow.cells[1].childNodes[0].childNodes[0];
iFieldID=oCtrlTable.getAttribute('FieldID');//error throws here
Richard Deeming 14-Aug-19 4:42am    
That would suggest there's a difference in the DOM tree between IE and Chrome.

That looks like a fairly fragile way of locating an element. Surely there must be a better way? For example, you could add a CSS class to identify the element, and then use querySelector[^] to find the element within the row.

1 solution

Try the example here: Button.OnClientClick Property (System.Web.UI.WebControls) | Microsoft Docs[^] and see if that works.
It might also be needed to add a semicolon in:
return SaveData();
 
Share this answer
 
v2
Comments
SukirtiShetty 13-Aug-19 5:22am    
I have checked return SaveData(); and still its not working for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900