Getting A RadTreeView in a RadPanelBar

4 posts, 0 answers
  1. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 07 Apr 2008 Link to this post

    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 %>;



    1                 <telerik:RadPanelbar ID="rpbAttibutes" runat="server" Skin="Vista" ExpandMode="FullExpandedItem" Height="100%" Width="100%">  
    2                     <Items> 
    3                         <telerik:RadPanelItem runat="server" Text="Thumbnails" Expanded="true">  
    4                             <Items> 
    5                                 <telerik:RadPanelItem Value="TemplateHolder" Height="100%">  
    6                                     <ItemTemplate> 
    7                                         <center> 
    8                                             <cc1:WebThumbnailViewer ID="wtvDoc" runat="server" Width="100%" Height="99%" ViewerID="wivDoc" BackColor="LightGray" BorderColor="#A7BAC5" BorderWidth="0" Centered="true" ScrollBarVisibility="Dynamic" /> 
    9                                         </center> 
    10                                     </ItemTemplate> 
    11                                 </telerik:RadPanelItem> 
    12                             </Items> 
    13                         </telerik:RadPanelItem> 
    14  

    ...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 %>;

    1                         <telerik:RadPanelBar ID="rpbCabinets" runat="server" Skin="Vista" ExpandMode="FullExpandedItem" Width="100%" Height="100%">  
    2                             <Items> 
    3                                 <telerik:RadPanelItem runat="server" Text="Cabinets" Expanded="True">  
    4                                     <Items> 
    5                                         <telerik:RadPanelItem runat="server" Value="TemplateHolder" Height="100%">  
    6                                             <ItemTemplate> 
    7                                                 <telerik:RadTreeView ID="rtvItems" runat="server" Width="100%" Height="99%" Skin="Office2007" LoadingStatusPosition="BelowNodeText" PersistLoadOnDemandNodes="true"   
    8                                                         OnClientNodeClicked="AfterClientClickHandler" 
    9                                                         OnClientContextMenuShowing="onClientContextMenuShowing" 
    10                                                         OnClientContextMenuItemClicked="onClientContextMenuItemClicked" 
    11                                                         OnNodeExpand="rtvItems_NodeExpand" 
    12                                                         OnNodeClick="rtvItems_NodeClick">  
    13                                                     <CollapseAnimation Duration="100" Type="OutQuint" /> 
    14                                                     <ExpandAnimation Duration="200" Type="OutQuint" /> 
    15                                                     <ContextMenus> 
    16                                                         <telerik:RadTreeViewContextMenu ID="rtvcmCabinet" Skin="Vista" runat="server" Flow="Horizontal">  
    17                                                             <Items> 
    18                                                                 <telerik:RadMenuItem Text="Create Folder" Value="CreateFolder" ExpandMode="ClientSide" runat="server" > 
    19                                                                     <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
    20                                                                 </telerik:RadMenuItem> 
    21                                                                 <telerik:RadMenuItem Text="Export Items" Value="ExportItems" ExpandMode="ClientSide" runat="server" ImageUrl="images/exportFolder.gif" > 
    22                                                                     <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
    23                                                                 </telerik:RadMenuItem> 
    24                                                                 <telerik:RadMenuItem Text="Import Item" Value="Import" ExpandMode="ClientSide" runat="server" > 
    25                                                                     <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
    26                                                                 </telerik:RadMenuItem> 
    27                                                                 <telerik:RadMenuItem Text="Export Item" Value="ExportItem" ExpandMode="ClientSide" runat="server" > 
    28                                                                     <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
    29                                                                 </telerik:RadMenuItem> 
    30                                                             </Items> 
    31                                                             <DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
    32                                                             <CollapseAnimation Duration="200" Type="OutQuint" /> 
    33                                                             <ExpandAnimation Type="OutQuart" /> 
    34                                                         </telerik:RadTreeViewContextMenu> 
    35                                                     </ContextMenus> 
    36                                                 </telerik:RadTreeView> 
    37                                             </ItemTemplate> 
    38                                         </telerik:RadPanelItem> 
    39                                     </Items> 
    40                                 </telerik:RadPanelItem> 
    41  

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

    Seth

  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 07 Apr 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 07 Apr 2008 Link to this post

    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
  5. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 08 Apr 2008 Link to this post

    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
Back to Top