Want to display a message when panelbar item is clicked

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

    Posted 19 May 2009 Link to this post

    Hi,

    I have a panelbar and whenever a particular item(say item 2)  is clicked, i need a message box specifying do you want to contiune to redirect to the another page or not.
     Protected Sub RadPanelBar5_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles RadPanelBar5.ItemClick  
     
            If TypeOf e.Item.Owner Is RadPanelItem Then  
                Dim parentItem As RadPanelItem = CType(e.Item.Owner, RadPanelItem)  
                Select Case parentItem.Text  
     
                    Case "Miscellaneous"  
                       
                        If e.Item.Owner.Items(5).Selected = True Then  
                       'Here i want to display a messagebox using Javascript, if i want to continue. 
                            Response.Redirect("~/MessageforNewVersion.aspx")  
                        End If  
                End Select  
            End If  
     
     
        End Sub 


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 May 2009 Link to this post

    Hi Syed,

    One suggestion would be using OnClientItemClicking client-side event to display confirmation message as shown below. Attach the OnClientItemClicking event and try the following code.

    JavaScript:
     
    <script type="text/javascript"
    function OnClientItemClicking(sender, eventArgs) 
    {       
      var item = eventArgs.get_item(); 
      if(item.get_parent().get_text() == "Miscellanious" && item.get_text() == "Child RadPanelItem 1" ) //Checking the parent item and clicked item text 
      {   
          if (confirm('Do you want to contiune to redirect to the another page ?')) 
          { 
             eventArgs.set_cancel(false); 
          } 
          else 
          { 
             eventArgs.set_cancel(true); // Cancel the event if clicked on "Cancel", so that the server event will not fire 
          } 
      } 
    </script> 

    Thanks,
    Shinu.
Back to Top