This is a migrated thread and some comments may be shown as answers.

Want to display a message when panelbar item is clicked

1 Answer 71 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 19 May 2009, 06:10 AM
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 


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 May 2009, 07:28 AM
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.
Tags
PanelBar
Asked by
Syed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or