Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


onclientclick and onclick asp.net button control

Posted on 2011-10-14
Medium Priority
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 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 800 total points
ID: 36971564
OnClientClick will be executed first, and if javascript function_Click returns true then Onclick method will execute

Accepted Solution

gopaltayde earned 1200 total points
ID: 36973048
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.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

564 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