Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Display A Confirm Box from a CodeBehind Page and Take Input Yes or No for further use.

Display A Confirm Box from a CodeBehind Page and Take Input Yes or No for further use.

Scheduled Pinned Locked Moved ASP.NET
tutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vkumar09
    wrote on last edited by
    #1

    Hi all, Can anyone suggest me how to write the confirm box in code behind and i want to get the return value whether the user clicked 'ok' or 'cancel', Depending on that i need to process further using if else

    A C 2 Replies Last reply
    0
    • V vkumar09

      Hi all, Can anyone suggest me how to write the confirm box in code behind and i want to get the return value whether the user clicked 'ok' or 'cancel', Depending on that i need to process further using if else

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      koushiksaha wrote:

      Can anyone suggest me how to write the confirm box in code behind

      Same way that your are doing using JavaScript. But Register that function from codbehind using ClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm('" + Are You Sure ?+ "');"); or if use ajax in your page then ScriptManager instate of ClientScript

      cheers, Abhijit My Recent Article : Beginner's Guide To View State

      M 1 Reply Last reply
      0
      • V vkumar09

        Hi all, Can anyone suggest me how to write the confirm box in code behind and i want to get the return value whether the user clicked 'ok' or 'cancel', Depending on that i need to process further using if else

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        koushiksaha wrote:

        how to write the confirm box in code behind

        You can't run a confirm box to branch the code in your code behind, obviously. If you're trying to confirm a button press, for example, then you put javascript directly in your aspx, and you call your javascript method in your OnClientClick. If OnClientClick returns false, then the OnClick is not called. If it returns true, then the OnClick is called.

        Christian Graus Driven to the arms of OSX by Vista.

        1 Reply Last reply
        0
        • A Abhijit Jana

          koushiksaha wrote:

          Can anyone suggest me how to write the confirm box in code behind

          Same way that your are doing using JavaScript. But Register that function from codbehind using ClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm('" + Are You Sure ?+ "');"); or if use ajax in your page then ScriptManager instate of ClientScript

          cheers, Abhijit My Recent Article : Beginner's Guide To View State

          M Offline
          M Offline
          mr_muskurahat
          wrote on last edited by
          #4

          you can use Ajax confirm button extender for your situation when you will press ok it will run codebehind function related to that control.... using registerstartupscript it can display confirm message box in code behind but this script does not return any value so you cannot handle it using that....

          umerumerumer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups