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