Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
hi everyone,
 
am facing problem with link button(logout)
 
this is my code
 
<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 28-Apr-13 2:31am
Comments
Sandeep Mewara at 28-Apr-13 8:15am
   
You say, you are not getting this confirm message box?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hey, change your link button event Onclick in to OnClientClick and change the return statement code.
<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" OnClientClick="return Javascript:confirm(' Are you sure you want to Logout?')">Logout</asp:LinkButton>
  Permalink  
Comments
Ubaid ur Rahman IT at 29-Apr-13 2:46am
   
sorry, this is not working. please help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Add This:-
 
<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" OnClientClick="return confirm(' Are you sure you want to Logout?')">Logout</asp:LinkButton>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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.
  Permalink  
v4

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



Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 30 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100