Click here to Skip to main content
15,906,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After OnClientClick event OnClick event not fire.
My code as follows.
JavaScript
function permissions() {
            var add = 1;
            if (add == 0) {
                alert("You have no permissions to Add Record");
                return false;
            }
            else
                return true;
        }

ASP.NET
<asp:Button ID="btn_new" CssClass="btn btn-sm btn-success" runat="server" Text="Add New" onclick="btn_new_Click" OnClientClick="javascript:return permissions();" />

what issue in my code? if not So why it not work well, please Provide Working Solutions..!!
Posted

ASP.NET
<asp:button id="btn_new" cssclass="btn btn-sm btn-success" runat="server" text="Add New" onclick="btn_new_Click" onclientclick="permissions();" xmlns:asp="#unknown" />
 
Share this answer
 
Comments
rahul003 11-Feb-14 3:48am    
It not work my side.
finally found solution my self.
<pre lang="HTML"><asp:button id="btn_new" cssclass="btn btn-sm btn-success" runat="server" text="Add New" onclientclick="if(!permissions()){return false;}" xmlns:asp="#unknown"></asp:button>
 
Share this answer
 
if it returns false the server code doesn't execute.... viceversa........
 
Share this answer
 

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

  Print Answers RSS


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