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

get URL of selected RadPanleBarItem in code behind

1 Answer 138 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Donald Catimbang
Top achievements
Rank 1
Donald Catimbang asked on 02 Jan 2009, 06:43 AM

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

1 Answer, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 06 Jan 2009, 09:31 AM
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.
Tags
PanelBar
Asked by
Donald Catimbang
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Share this question
or