Display a message specifying continue or not when clicked on panel bar item

2 posts, 1 answers
  1. Syed
    Syed avatar
    74 posts
    Member since:
    Mar 2009

    Posted 06 Jun 2009 Link to this post

    Hi,

    Whenever a panel bar item is clicked in panel bar, i want to display a message whether to continue or not. If clicked ok then redirect to some page else cancel the item.

    Thanks.

    Regards
    Syed Arshad
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Jun 2009 Link to this post

    Hello Syed,

    Attach OnClientItemClicking event in order to show confirm message and to cancel the ItemClick if clicked cancel.

    ASPX:
     
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnClientItemClicking="OnClientItemClicking"
        <Items> 
            <telerik:RadPanelItem runat="server" Text="Root RadPanelItem1"
                <Items> 
                    <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1" NavigateUrl="http://www.google.com"
                    . . . 
                </Items> 
            </telerik:RadPanelItem> 
            . . . 
        </Items> 
    </telerik:RadPanelBar> 

    JavaScript:
     
    <script type="text/javascript"
    function OnClientItemClicking(sender, eventArgs) 
       var item = eventArgs.get_item(); 
       var navigateUrl = item.get_navigateUrl(); 
       if (navigateUrl && navigateUrl != "#")  //Check whether having NavigateUrl set 
       { 
          var proceed = confirm("Navigate to "+ navigateUrl + " ?"); 
          if (!proceed) 
          { 
             eventArgs.set_cancel(true); // Cancel the Item Click 
          } 
          else 
          { 
             eventArgs.set_cancel(false); 
          } 
       } 
    </script> 

    Thanks,
    Shinu.
Back to Top