Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use loginview in asp.


JavaScript
<script type="text/javascript">
            {
                if (confirm("Are You Sure to logout??") = true)
                    return true;
                else
                    return false;
           } </script>


code behind :

C#
btl1.Attributes.Add("onclick","return confirm_logout();")



how to use for Login View.
Posted
Updated 19-Feb-15 19:03pm
v2

create function with the name you put in the code btl1.Attributes.Add("onclick","return confirm_logout();")
JavaScript
<script type="text/javascript">

	function confirm_logout()
	{
		return confirm("Are You Sure to logout??");
	} 
</script>

refer below thread if you have loginview control and need to call javascript method on button click event.
LoginStatus Confirmation Message[^]
 
Share this answer
 
v3
Comments
Shrikesh_kale 20-Feb-15 0:45am    
tried it but do not work
DamithSL 20-Feb-15 0:55am    
your if condition is wrong, check my updated answer
OnClientClick you can call the javascript method..

<asp:button id="btl1" onclientclick="LogOut()" xmlns:asp="#unknown" />
JavaScript
<script type="text/javascript">
    function logout()
    {
        return confirm("Are You Sure to logout?");
    }
</script>


If this solves your issue kindly up vote and mark this as solution.. Thanks..
 
Share this answer
 
v2

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