get URL of selected RadPanleBarItem in code behind

2 posts, 0 answers
  1. Donald Catimbang
    Donald Catimbang avatar
    4 posts
    Member since:
    Dec 2008

    Posted 02 Jan 2009 Link to this post

    This is my XAML Code

     

    <radDock:RadPane x:Name="pnlBarAccounting" Header="Accounting">

        <telerikNavigation:RadPanelBar x:Name="pnlBar">

          <telerikNavigation:RadPanelBar.ItemTemplate>

                <core:HierarchicalDataTemplate ItemsSource="{Binding SubCategories}" >

                      <StackPanel Orientation="Horizontal">

                            <Image Source="{Binding Images}" Margin="2" />

                            <TextBlock x:Name="txtAccName" Text="{Binding Name}" VerticalAlignment="Center" MouseEnter="TextBlock_MouseEnter"></TextBlock>

                            <TextBlock x:Name="txtAccCustomUrl" Text="{Binding CustomUrl}" VerticalAlignment="Center" Visibility="Collapsed"></TextBlock>

    </StackPanel>

    </core:HierarchicalDataTemplate>

          </telerikNavigation:RadPanelBar.ItemTemplate>

         </telerikNavigation:RadPanelBar>

    </radDock:RadPane>


    And this is my XML content


    <PanelItem ID="ChartofAccounts" Image="/book_24.gif" Text="PanelItem1" CustomUrl="../ CustomUrl.aspx"/>

     

    I bound the XML file to RadPanelBar using HierarchicalDataTemplate.(Reference from http://www.telerik.com/community/forums/silverlight/panelbar/hierarchical-databinding.aspx) It is showing correct records.

     

    Now my problem is…

    1.  I want to get value of CustomeURL of selected RadPanleBarItem in code behind.i.e. When I click on PanelItem1 it would return “CustomUrl.aspx”

    2.  I want to do same thing with RadtreeView control.

    3.  And if I Wrap this silverLightControl in any aspx page using <asp:Silverlight ID="Xaml1" runat="server" Source="SilverLightApp.xap" />  Then how can I paas this Url into ASPX page.

    Please give me any solution ASAP.

    Thanks

  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 06 Jan 2009 Link to this post

    Hi Donald,

    You can get the CustomUrl of the selected item like this - selectedItem.CustomUrl

    As for passing "this Url into ASPX page", you don't mention your specific scenario but there are generally two options:

    1) If you need the data on the server you'll have to pass it to a web service and process it once it's received

    2) If you need to use the Url on the client machine you'll most probably have to pass the data to a JavaScript method as follows:

    System.Windows.Browser.HtmlPage.Document.Invoke(string name, params object[] args)

    Here is a good article about Integrating Silverlight with a web page:
    http://msdn.microsoft.com/en-us/library/cc838145(VS.95).aspx

    I am attaching an updated version of the sample project Hristo sent you. Let me know if this helps.

    Sincerely yours,
    Tihomir Petkov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
Back to Top