Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my asp.net application two different users,when user press on logout,it prompt for "Yes" or " No" . if user wants to stay on the page click " No" or he wants leave then clicks "yes"....but i want user will stay on current page when he clicks on "No" button ... Using sessions please help me

thanks in regards
Posted
Comments
Nagasreenu Pasupuleti 1-Aug-11 9:12am    
thanking you for helping

on your object (Button?)
add the next
button1.Attributes.Add("onclick", "return confirm(\"Are you sure?\")");
you do this in the Page OnLoad event

if the user selects OK the on click event of the button will be fired otherwise nothing happens
 
Share this answer
 
v3
Add this in your logout button.
<asp:Button ID="btnLogout" runat="server" Text="Logout" OnClientClick="return confirm('Are you sure to logout?') />

But, this will display Ok and Cancel button. If you need Yes and No you have to create your own custom control.
 
Share this answer
 
v2
Comments
Herman<T>.Instance 1-Aug-11 8:50am    
you are right

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900