How to connect TreeListTemplateColumn element behaviour with TreeListBoundColumn value.

2 posts, 0 answers
  1. Arkadiusz
    Arkadiusz avatar
    1 posts
    Member since:
    Feb 2011

    Posted 07 Jul 2011 Link to this post

    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>
  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 12 Jul 2011 Link to this post

    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!

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top