Targeting links in RadPanelBar to RadPane in RadSplitter

9 posts, 0 answers
  1. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 18 Aug 2010 Link to this post

    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!
  2. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 19 Aug 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bala
    Bala avatar
    4 posts
    Member since:
    Aug 2012

    Posted 18 Sep 2012 Link to this post

    Hi Steve, I am having the same problem. Could you please share with me the code for the item click. Hanks Nick
  5. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 18 Sep 2012 Link to this post

    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!
  6. Bala
    Bala avatar
    4 posts
    Member since:
    Aug 2012

    Posted 19 Sep 2012 Link to this post

    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


  7. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 19 Sep 2012 Link to this post

    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!
  8. Bala
    Bala avatar
    4 posts
    Member since:
    Aug 2012

    Posted 19 Sep 2012 Link to this post

    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

     

  9. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 19 Sep 2012 Link to this post

    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.
  10. Bala
    Bala avatar
    4 posts
    Member since:
    Aug 2012

    Posted 19 Sep 2012 Link to this post

    Hi Steve,

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

    Bala
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017