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

Targeting links in RadPanelBar to RadPane in RadSplitter

8 Answers 172 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Steve LaForge
Top achievements
Rank 1
Steve LaForge asked on 18 Aug 2010, 11:58 PM
I have a splitter that contains left, main and right panes.  The left pane contains a panelbar.  I want to use the actions in the panelbar to direct results to the main pane.  I'm using the code below.  Everything is opening in a new window.

<telerik:RadSplitter ID="spltBody" runat="server" Width="100%" BorderSize="0">
  <telerik:RadPane ID="paneLeft" runat="server" Width="200">
    <div style="margin: 0px 3px 0px 5px;">
      <telerik:RadPanelBar ID="pbarMenu" runat="server" Width="100%">
        <Items>
          <telerik:RadPanelItem runat="server" Selected="True" Text="About Us" 
            Expanded="true">
            <Items>
              <telerik:RadPanelItem runat="server" NavigateUrl="http://localhost/standards/default.aspx" 
                Target="<%= paneBody.ClientID %>" Text="Who We Are" Selected="true">
              </telerik:RadPanelItem>
              <telerik:RadPanelItem runat="server" NavigateUrl="corevalues.aspx" Target="<%= paneBody.ClientID %>" 
                Text="Core Values">
              </telerik:RadPanelItem>
            </Items>
          </telerik:RadPanelItem>
          <telerik:RadPanelItem runat="server" NavigateUrl="benefits.aspx" 
            Target="<%= paneBody.ClientID %>" Text="Benefits">
          </telerik:RadPanelItem>
          <telerik:RadPanelItem runat="server" NavigateUrl="careers.aspx" Target="<%= paneBody.ClientID %>" 
            Text="Career Opportunities">
          </telerik:RadPanelItem>
          <telerik:RadPanelItem runat="server" Text="Contact Us">
            <Items>
              <telerik:RadPanelItem runat="server">
                <ItemTemplate>
                  If you have questions, you can contact Al Plourde at 
                </ItemTemplate>
              </telerik:RadPanelItem>
            </Items>
          </telerik:RadPanelItem>
        </Items>
      </telerik:RadPanelBar>      
    </div>
  </telerik:RadPane>
  <telerik:RadPane ID="paneBody" runat="server">
    <div style="margin: 0px 3px 0px 5px;">
    This is the main body
    </div>
  </telerik:RadPane>
  <telerik:RadPane ID="paneRight" runat="server" Width="150">
    <div style="margin: 0px 3px 0px 5px;">
    This is the right pane
    </div>
  </telerik:RadPane>
</telerik:RadSplitter>

Thanks!

8 Answers, 1 is accepted

Sort by
0
Steve LaForge
Top achievements
Rank 1
answered on 19 Aug 2010, 07:43 PM
I resolved this issue by assigning a value to each of my panelbar items and then using a select case statement in the ItemClick event to assign paneBody.ContentUrl to the correct value.
0
Bala
Top achievements
Rank 1
answered on 18 Sep 2012, 06:11 PM
Hi Steve, I am having the same problem. Could you please share with me the code for the item click. Hanks Nick
0
Steve LaForge
Top achievements
Rank 1
answered on 18 Sep 2012, 07:17 PM
Here is some sample code that you should be able to use...

Protected Sub pbarMenu_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles pbarMenu.ItemClick
  Dim selectedValue As String = e.Item.Value
  Dim currentContent As String = paneBody.ContentUrl
  Dim newContent As String = ""
  Select Case CType(selectedValue, Integer)
    Case 0
      newContent = "somepage.aspx"
    Case 1
      newContent = "another.aspx"
    Case 2
      newContent = "someotherpage.aspx"
    Case Else
      newContent = "http://www.microsoft.com"
  End Select
  If newContent <> currentContent Then
    paneBody.ContentUrl = newContent
  End If
End Sub

The only thing that is at all special about the code is the last 'If newContent...'.  All that does is prevent reloading the target if it is already loaded.  You may or may not want to do that.

Hope it helps!
0
Bala
Top achievements
Rank 1
answered on 19 Sep 2012, 12:03 PM
Hi Steve,
 
Thanks for your swift response. Unfotunatley it didnt work for. Not sure whether there is any mistakes on my side. Below is the code that i am using and would really appreciate if you could help. BTW i am using amaster page.

<telerik:RadPane ID="Radpane3" runat="server" Width="250">
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Black">

 

<CollapseAnimation Type="None"></CollapseAnimation>

 

<Items>

 

<telerik:RadPanelItem Text="Technologies" Expanded="True">

 

<Items>

<telerik:RadPanelItem Text="# of Technologies" NavigateUrl="nogapfundedprojects.aspx" Value=0 Target="<%= contentPane2.ClientID %>" ></telerik:RadPanelItem>

 

<telerik:RadPanelItem Text="# Technologies by RIs" NavigateUrl="nogapfundedprojects.aspx" Target="contentPane2"></telerik:RadPanelItem> 

 

</Items>

 

</telerik:RadPanelItem>

 

</Items>

 

<ExpandAnimation Type="None"></ExpandAnimation>

 

</telerik:RadPanelBar>

 

</telerik:RadPane>

Protected

 

 

Sub RadPanelBar1_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles RadPanelBar1.ItemClick

 

Dim selectedValue As String = e.Item.Value

 

Dim currentContent As String = contentPane2.ContentUrl

 

Dim newContent As String = ""

 

Select Case CType(selectedValue, Integer)

 

Case 0

newContent=

 

"nogapfundedprojects.aspx"

 

 

Case Else

newContent =

 

"http://www.microsoft.com"

End Select 

 

If newContent <> currentContent Then

contentPane2.ContentUrl = newContent

 

End If
End Sub


0
Steve LaForge
Top achievements
Rank 1
answered on 19 Sep 2012, 12:36 PM
I'm sorry, but that is a piece of code that I am no longer using, so I can't just pull out the existing code.  I had what I sent you yesterday still in the code but commented out.  I would suggest that you run your project in debug mode and set a breakpoint in the ItemClick event to be sure that you are getting control and seeing the value as you expect.

I was using it in a master page too, so I do know that it will work.

Good luck!
0
Bala
Top achievements
Rank 1
answered on 19 Sep 2012, 03:10 PM
Hi Steve,

Thanks for your response. Just realised that the Panelbar_itemclick event is not firing when the RadPanelItem is clicked. I am not sure how we could trap the event. If i have my links on the RadpanelBar then it could be straight forward. I am using thee Radpanelbar to group the links using Radpanelitems.

I will try to explore further and again any help would be of great help.

Thanks 

Bala

 

0
Steve LaForge
Top achievements
Rank 1
answered on 19 Sep 2012, 03:47 PM
I suggest that you look at article http://www.telerik.com/help/aspnet-ajax/menu-itemclick-event-not-fired.html.  It specifically says that the ItemClick event will not fire if you have specified the NavigateUrl parameter.  From your sample code, I see that you have it specified so that would explain why.
0
Bala
Top achievements
Rank 1
answered on 19 Sep 2012, 04:10 PM
Hi Steve,

Thanks. You are spot on and it resolved the problem.
Once again thank you very much and appreciate your help:)

Bala
Tags
Splitter
Asked by
Steve LaForge
Top achievements
Rank 1
Answers by
Steve LaForge
Top achievements
Rank 1
Bala
Top achievements
Rank 1
Share this question
or