onclientclick and onclick button control

Posted on 2011-10-14
Last Modified: 2012-06-27
I want to know if i can call 1 java script function with one client button click and one function with onclick for one control.

like this: <asp:button Text=“e”
                     OnClientClick=“javascript function_Click”
                     runat=“server” />      
And which one will be executed first?
I want the javascript to post the confirm message and postback user info to another page.
Question by:XPLR
    LVL 35

    Assisted Solution

    by:Miguel Oz
    OnClientClick will be executed first, and if javascript function_Click returns true then Onclick method will execute
    LVL 7

    Accepted Solution

    client side javascript function will get executed first. Just change the OnClientClick=“javascript function_Click” to OnClientClick=“javascript:return function_Click();”. And this  function_Click() should return either true or false. If it returns true, then the page will be posted.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now