Trying to log out with a button click on the tool bar called LogOut and use a confirmation notice. Here is my code which is on my masterpage. when I click on the button, it logs out but does not give the confirmation.
My code behind looks like this:
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
<telerik:RadToolBar ID="RadToolBar1" AutoPostBack="true" Runat="server" |
onbuttonclick="RadToolBar1_ButtonClick"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
<Items> |
<telerik:RadToolBarButton runat="server" NavigateUrl="~/default.aspx" |
Target="_parent" Text="Requirements"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" |
NavigateUrl="http://cjis4/Reports/Pages/Report.aspx?ItemPath=%2fCIJS%2fRequirements" |
Target="_blank" Text="Report"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" NavigateUrl="~/Audit.aspx" |
Target="_parent" Text="Audit"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" NavigateUrl="~/Deleted.aspx" |
Target="_parent" Text="Deleted"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" NavigateUrl="~/change.aspx" |
Target="_parent" Text="Change Password"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton Text="Log Out" CommandName="LogOut"> |
</telerik:RadToolBarButton> |
</Items> |
</telerik:RadToolBar> |
<script type="text/javascript"> |
function clientbuttonclick(sender, args) { |
var button = args.get_item(); |
if (button.get_commandName() == "LogOut") { |
args.set_cancel(!confirm('Log Out?')); |
} |
} |
</script> |
My code behind looks like this:
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}