Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Confirm (MessageBox) in c#, asp.net

Last post 04-04-2008 4:35 AM by Freon22. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-28-2008 8:14 AM

    • girlkulit
    • Top 500 Contributor
    • Joined on 01-17-2008
    • Philippines
    • Member
    • Points 480

    Confirm (MessageBox) in c#, asp.net

    How can I do the confirm in c# and asp.net? The process is,  I have to confirm whether the user is sure that he/she wants to continue. The process of 'continue' is a block of codes (function). If it is yes, it should call the function btnOK_Click. (Is my explanation clear?)

    Please help.. If you need clarifications, please tell me...

     Thanks in advance.. ü

    i couldn't sleep, and wouldn't sleep, [love] asp.net and c# came and told me i shouldn't sleep, bewitched bothered and bewildered, am i
    • Post Points: 10
  • 04-02-2008 12:24 PM In reply to

    • Malk0
    • Not Ranked
    • Joined on 04-02-2008
    • Malta
    • New Member
    • Points 20

    Re: Confirm (MessageBox) in c#, asp.net

     Hi,

     To include a confirmation on your button, you have to include the following script in the HTML code (or add it through your C# code).

    <input type="submit" name="btnSubmit" id="btnSubmit"
         onclick="return confirm('Are you sure you want to Submit?');" />

    With the above code, the button only gets executed (from the browser) if the user presses ok.

    It also depends whether you are using a normal button or a link button.

    try goggling the following: http://www.google.com/search?hl=en&q=asp.net+alert+box&btnG=Search 

    Regards, 

    • Post Points: 10
  • 04-03-2008 5:56 AM In reply to

    • girlkulit
    • Top 500 Contributor
    • Joined on 01-17-2008
    • Philippines
    • Member
    • Points 480

    Re: Confirm (MessageBox) in c#, asp.net

    Hmm, what will I add for if the user clicks on OK, I have to execute a function in the code behind?

    Thanks in advance... ü

    i couldn't sleep, and wouldn't sleep, [love] asp.net and c# came and told me i shouldn't sleep, bewitched bothered and bewildered, am i
    • Post Points: 10
  • 04-03-2008 8:50 PM In reply to

    • Freon22
    • Top 200 Contributor
    • Joined on 06-22-2005
    • United States
    • Addicted Member
    • Points 725

    Re: Confirm (MessageBox) in c#, asp.net

    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return confirm('Are you sure?')" onclick="btnOK_Click" />

    • Post Points: 10
  • 04-04-2008 3:16 AM In reply to

    • girlkulit
    • Top 500 Contributor
    • Joined on 01-17-2008
    • Philippines
    • Member
    • Points 480

    Re: Confirm (MessageBox) in c#, asp.net

    That is what I call answer! Many thanks! Yes

    i couldn't sleep, and wouldn't sleep, [love] asp.net and c# came and told me i shouldn't sleep, bewitched bothered and bewildered, am i
    • Post Points: 10
  • 04-04-2008 4:35 AM In reply to

    • Freon22
    • Top 200 Contributor
    • Joined on 06-22-2005
    • United States
    • Addicted Member
    • Points 725

    Re: Confirm (MessageBox) in c#, asp.net

    You are welcome Big Smile and thanks you for the thank you.

    • Post Points: 5
Page 1 of 1 (6 items)