What Am I missing?

3 posts, 1 answers
  1. derek
    derek avatar
    13 posts
    Member since:
    Mar 2009

    Posted 25 Mar 2009 Link to this post

    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.

    <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();
        }

  2. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 25 Mar 2009 Link to this post

    Hi derek,

    It seems that you have not subscribed to the OnClientButtonClicking event. Please modify your code like this:

    <telerik:RadToolBar ID="RadToolBar1" AutoPostBack="true" Runat="server"   OnClientButtonClicking="clientbuttonclick"
            onbuttonclick="RadToolBar1_ButtonClick"> 

    Greetings,
    Albert
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. derek
    derek avatar
    13 posts
    Member since:
    Mar 2009

    Posted 25 Mar 2009 Link to this post

    AHHHH, thats what I missed!  Thank you Albert!!
Back to Top