Click here to Skip to main content
15,896,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone,

am facing problem with link button(logout)

this is my code

XML
<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" OnClick="return confirm(' Are you sure you want to Logout?')"
                            >Logout</asp:LinkButton>


I need a popup msg please help, thanks in advance.
Posted
Comments
Sandeep Mewara 28-Apr-13 8:15am    
You say, you are not getting this confirm message box?

hey, change your link button event Onclick in to OnClientClick and change the return statement code.
XML
<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" OnClientClick="return Javascript:confirm(' Are you sure you want to Logout?')">Logout</asp:LinkButton>
 
Share this answer
 
Comments
Ubaid ur Rahman IT 29-Apr-13 2:46am    
sorry, this is not working. please help.
remove the RETURN keyword from onclientclick event.
<asp:linkbutton id="LinkButton3" runat="server" causesvalidation="False" onclientclick=" Javascript:confirm(' Are you sure you want to Logout?')" xmlns:asp="#unknown">Logout
 
Share this answer
 
Add This:-

<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" OnClientClick="return confirm(' Are you sure you want to Logout?')">Logout</asp:LinkButton>
 
Share this answer
 
you can try confirm button extender ....

code:

<asp:linkbutton id="LinkButton3" runat="server"
>Logout
<asp:confirmbuttonextender id="Imgdel_ConfirmButtonExtender" runat="server" ConfirmText=Are you sure you want to Logout ? Enabled=True TargetControlID=LinkButton3>



i think it helps u.
 
Share this answer
 
v4

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