Websforms want jQuery confirm after button clicked

Hi

I have a web form that a user is entering hours worked. When the user presses the button

<asp:Button ID="cmdSubmit" CausesValidation="true" runat="server" Text="Submit Hours" OnClick="cmdSubmit_Click" />

I would like a jQuery box to ask if the hours that have been tallied and put in this put in this textbox

<asp:TextBox ID="TotalHours"  CssClass="data-input"  ClientIDMode="Static" runat="server" />

to appear and ask if the value in this textbox are correct.  If the user chooses "Yes" I want the dialogbox to go on and execute the event at

OnClick="cmdSubmit_Click"
 
 if not I want the event to not happen
Charles BaldoSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Miguel OzSenior Software EngineerCommented:
Use OnClientClick event and return true to execute server event otherwise false.
<asp:Button ID="cmdSubmit" CausesValidation="true" runat="server" Text="Submit Hours" OnClick="cmdSubmit_Click" OnClientClick="return callMethod();" />
<script type="text/javascript">
    function callMethod() {
       //logic prior dialog goes here
       $('#TotalHours').val('Set your new value here')
        return confirm('Your message here asking yes/no') == true;
}
</script>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Charles BaldoSoftware DeveloperAuthor Commented:
Excellent

Thanks again Miguel
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.