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

How to connect TreeListTemplateColumn element behaviour with TreeListBoundColumn value.

1 Answer 87 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Arkadiusz
Top achievements
Rank 1
Arkadiusz asked on 07 Jul 2011, 12:37 PM
Hello,
I have a trivial problem, probably. Unfortunatelly I have no idea how to solve it. Bellow is my sample code to ilustrate the problem.
My TemplateColumn content (RadGrid2 control) has to have different functionality depends on Selectror column contents.
All ideas about what event of TemplateColumn or RadGrid2 (or others) i should use and how to get current Selector column/row value will be worm welcome. 
<telerik:RadTreeList ID="rtv" runat="server" DataSourceID="SqlDS" DataKeyNames="ID_ELEMENT" ParentDataKeyNames="ID_PARENT" DataMember="DefaultView" >
   <Columns>
      <telerik:TreeListBoundColumn DataField="Name" HeaderText="Name" UniqueName="columnName" ReadOnly="True">
      </telerik:TreeListBoundColumn>
      <telerik:TreeListBoundColumn DataField="SELECTOR" HeaderText="SELECTOR" ReadOnly="True" DataType="System.Int32" UniqueName="columnSELECTOR" Visible="False">
      </telerik:TreeListBoundColumn>
      <telerik:TreeListTemplateColumn UniqueName="Template" HeaderText="Template"
                DataField="ID_ELEMENT">
         <ItemTemplate>
            <telerik:RadGrid ID="RadGrid2" runat="server"  DataSourceID="SqlDS2">
               <MasterTableView DataSourceID="SqlDS2"></MasterTableView>
            </telerik:RadGrid>
         </ItemTemplate>
      </telerik:TreeListTemplateColumn>
   </Columns>
</telerik:RadTreeList>
 
<asp:SqlDataSource ID="SqlDS" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT_COMMAND" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
 
<asp:SqlDataSource ID="SqlDS2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT_TEMPLATE" SelectCommandType="StoredProcedure">
   <SelectParameters>
      <asp:Parameter DefaultValue="0" Name="PARAM" Type="Int32" />
   </SelectParameters>
</asp:SqlDataSource>

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 12 Jul 2011, 03:35 PM
Hi Arkadiusz,

 It depends what kind of functionality you need to enable for the grid. If it can be done by simply setting a property of RadGrid you can do this in the ItemDataBound event for the RadTreeList. There you can access the desired column and get its value (for the selector column) or find the nested grid in the case of the template column using the FindControl method. More information can be found in this help topic.

Greetings,
Marin
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
TreeList
Asked by
Arkadiusz
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or