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

Getting A RadTreeView in a RadPanelBar

3 Answers 134 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 07 Apr 2008, 03:12 PM
In a previous post I asked this question and I got a working response.  I was able to use...

myThumb = <%= rpbAttibutes.FindItemByValue(
"TemplateHolder").FindControl("wtvDoc").ClientID %>;



                <telerik:RadPanelbar ID="rpbAttibutes" runat="server" Skin="Vista" ExpandMode="FullExpandedItem" Height="100%" Width="100%">  
                    <Items> 
                        <telerik:RadPanelItem runat="server" Text="Thumbnails" Expanded="true">  
                            <Items> 
                                <telerik:RadPanelItem Value="TemplateHolder" Height="100%">  
                                    <ItemTemplate> 
                                        <center> 
                                            <cc1:WebThumbnailViewer ID="wtvDoc" runat="server" Width="100%" Height="99%" ViewerID="wivDoc" BackColor="LightGray" BorderColor="#A7BAC5" BorderWidth="0" Centered="true" ScrollBarVisibility="Dynamic" /> 
                                        </center> 
                                    </ItemTemplate> 
                                </telerik:RadPanelItem> 
                            </Items> 
                        </telerik:RadPanelItem> 
 

...to get a control from inside a RadPanelBar Item control.

I am calling that script on a page load event and it works fine.  This code, although it gives me an [object], does not give me the actual treeview object.

oTree = <%= rpbCabinets.FindItemByValue(
"TemplateHolder").FindControl("rtvItems").ClientID %>;

                        <telerik:RadPanelBar ID="rpbCabinets" runat="server" Skin="Vista" ExpandMode="FullExpandedItem" Width="100%" Height="100%">  
                            <Items> 
                                <telerik:RadPanelItem runat="server" Text="Cabinets" Expanded="True">  
                                    <Items> 
                                        <telerik:RadPanelItem runat="server" Value="TemplateHolder" Height="100%">  
                                            <ItemTemplate> 
                                                <telerik:RadTreeView ID="rtvItems" runat="server" Width="100%" Height="99%" Skin="Office2007" LoadingStatusPosition="BelowNodeText" PersistLoadOnDemandNodes="true"   
                                                        OnClientNodeClicked="AfterClientClickHandler" 
                                                        OnClientContextMenuShowing="onClientContextMenuShowing" 
                                                        OnClientContextMenuItemClicked="onClientContextMenuItemClicked" 
                                                        OnNodeExpand="rtvItems_NodeExpand" 
                                                        OnNodeClick="rtvItems_NodeClick">  
                                                    <CollapseAnimation Duration="100" Type="OutQuint" /> 
                                                    <ExpandAnimation Duration="200" Type="OutQuint" /> 
                                                    <ContextMenus> 
                                                        <telerik:RadTreeViewContextMenu ID="rtvcmCabinet" Skin="Vista" runat="server" Flow="Horizontal">  
                                                            <Items> 
                                                                <telerik:RadMenuItem Text="Create Folder" Value="CreateFolder" ExpandMode="ClientSide" runat="server" > 
                                                                    <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                                                                </telerik:RadMenuItem> 
                                                                <telerik:RadMenuItem Text="Export Items" Value="ExportItems" ExpandMode="ClientSide" runat="server" ImageUrl="images/exportFolder.gif" > 
                                                                    <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                                                                </telerik:RadMenuItem> 
                                                                <telerik:RadMenuItem Text="Import Item" Value="Import" ExpandMode="ClientSide" runat="server" > 
                                                                    <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                                                                </telerik:RadMenuItem> 
                                                                <telerik:RadMenuItem Text="Export Item" Value="ExportItem" ExpandMode="ClientSide" runat="server" > 
                                                                    <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                                                                </telerik:RadMenuItem> 
                                                            </Items> 
                                                            <DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                                                            <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                                            <ExpandAnimation Type="OutQuart" /> 
                                                        </telerik:RadTreeViewContextMenu> 
                                                    </ContextMenus> 
                                                </telerik:RadTreeView> 
                                            </ItemTemplate> 
                                        </telerik:RadPanelItem> 
                                    </Items> 
                                </telerik:RadPanelItem> 
 

Do I need to type cast it or something?  How do I do that?

Seth

3 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 07 Apr 2008, 03:45 PM
Hi Seth,

You need to convert the object to type of RadTreeView.

You can do it by using the following code:
myThumb = <%= Ctype(rpbAttibutes.FindItemByValue("TemplateHolder").FindControl("wtvDoc"),RadTreeView).ClientID %>;  
 

Hope this helps.

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Seth
Top achievements
Rank 1
answered on 07 Apr 2008, 05:13 PM
No luck.  Strange, that same code works fine in the vb codebehind.

I assigned a global variable to the TreeView in the OnClientNodeClicked event, I am hoping I don't need access to the treeview before that event is fired.

Thanks anyway.

Seth
0
Rosi
Telerik team
answered on 08 Apr 2008, 03:47 PM
Hello Seth,

Yes, the code I sent you is for VB. The code for C# will be

myThumb = <%= ((RadTreeView) rpbAttibutes.FindItemByValue("TemplateHolder").FindControl("wtvDoc")).ClientID %>;   

I am sorry for the inconvenience.


Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
PanelBar
Asked by
Seth
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Seth
Top achievements
Rank 1
Share this question
or