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. how2 add confirmation pop up upon loging out (LoginStatus control)

how2 add confirmation pop up upon loging out (LoginStatus control)

Scheduled Pinned Locked Moved ASP.NET
javascriptquestiondiscussion
5 Posts 2 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.
  • Y Offline
    Y Offline
    yet_alive
    wrote on last edited by
    #1

    Hello every one :) i am trying to find a way to add a pop-up confirmation to LoginStatus control when you click Logout. here is the code i tried.. with no luck of pop up showing up..:confused: i'd appreciate any thoughts/suggestions/corrections! i have set the "LoggingOut" event of the LoginStatus control to: (userLoggingOut). My loginStatus control is: logStatus and then tried both of these codes in the code behind.. still i cant see the confirm message pop up! any idea what i might have been doing wrong? thank u so much in advance :D protected void userLoggingOut(object sender, LoginCancelEventArgs e) { LoginStatus lgst1 = (LoginStatus)FindControl("logStatus"); lgst1.Attributes.Add("OnLoggingOut", "return confirm('Are you sure')"); } ======>>>> and i tried this too: protected void userLoggingOut(object sender, LoginCancelEventArgs e) { string Msg = "are u sure"; LoginStatus lgst2 = (LoginStatus)FindControl("logStatus"); lgst2.Attributes.Add("onclick", "javascript:return " + " confirm('" + Msg + "') "); }

    full many flowers blush unseen!

    K 1 Reply Last reply
    0
    • Y yet_alive

      Hello every one :) i am trying to find a way to add a pop-up confirmation to LoginStatus control when you click Logout. here is the code i tried.. with no luck of pop up showing up..:confused: i'd appreciate any thoughts/suggestions/corrections! i have set the "LoggingOut" event of the LoginStatus control to: (userLoggingOut). My loginStatus control is: logStatus and then tried both of these codes in the code behind.. still i cant see the confirm message pop up! any idea what i might have been doing wrong? thank u so much in advance :D protected void userLoggingOut(object sender, LoginCancelEventArgs e) { LoginStatus lgst1 = (LoginStatus)FindControl("logStatus"); lgst1.Attributes.Add("OnLoggingOut", "return confirm('Are you sure')"); } ======>>>> and i tried this too: protected void userLoggingOut(object sender, LoginCancelEventArgs e) { string Msg = "are u sure"; LoginStatus lgst2 = (LoginStatus)FindControl("logStatus"); lgst2.Attributes.Add("onclick", "javascript:return " + " confirm('" + Msg + "') "); }

      full many flowers blush unseen!

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      You have the right concept, but you are trying to add the javascript too late. YOu need to add the javascript to the logout button on the page load and it should be on the onClick event. That way the java script will be in the page when the user clicks the button to log out. Hope that helps. Ben

      Y 1 Reply Last reply
      0
      • K kubben

        You have the right concept, but you are trying to add the javascript too late. YOu need to add the javascript to the logout button on the page load and it should be on the onClick event. That way the java script will be in the page when the user clicks the button to log out. Hope that helps. Ben

        Y Offline
        Y Offline
        yet_alive
        wrote on last edited by
        #3

        OMG i thank u soOoOoO :-D much!! it worked at last!! this indeed was the problem!! i was searching for God knows for how many days! may i ask you kindly to shed some light on the Add Attribute. i was trying (failed) to find.. how come we could Add an Attribute "onClick" to the loginStatus control.. although it doesnt have this as an Event in its list of events? thank u so much for any info u might share :)

        full many flowers blush unseen!

        K 1 Reply Last reply
        0
        • Y yet_alive

          OMG i thank u soOoOoO :-D much!! it worked at last!! this indeed was the problem!! i was searching for God knows for how many days! may i ask you kindly to shed some light on the Add Attribute. i was trying (failed) to find.. how come we could Add an Attribute "onClick" to the loginStatus control.. although it doesnt have this as an Event in its list of events? thank u so much for any info u might share :)

          full many flowers blush unseen!

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #4

          What you are seeing for the events are the asp.net events. When the web server sends html to the web browser all of the asp.net controls get translated to html controls. The html control has the onClick event. Javascript is always dealing with the html controls and their events, not the asp.net controls and their events. Hope that helps. Ben

          Y 1 Reply Last reply
          0
          • K kubben

            What you are seeing for the events are the asp.net events. When the web server sends html to the web browser all of the asp.net controls get translated to html controls. The html control has the onClick event. Javascript is always dealing with the html controls and their events, not the asp.net controls and their events. Hope that helps. Ben

            Y Offline
            Y Offline
            yet_alive
            wrote on last edited by
            #5

            i see!! very valuable information :-D thank you very much indeed!

            full many flowers blush unseen!

            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