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

How do I find the lbljson in a nested grid?

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
komeil
Top achievements
Rank 1
komeil asked on 26 May 2015, 01:04 PM

plz help me

 How do I find the lbljson in a nested grid?

findcontrol

<telerik:RadGrid ID="RadGrid3" runat="server" ShowStatusBar="True" AutoGenerateColumns="False"
           PageSize="7" AllowSorting="True" AllowPaging="True"
           OnDetailTableDataBind="RadGrid3_DetailTableDataBin  d" OnNeedDataSource="RadGrid3_NeedDataSource"
           OnPreRender="RadGrid3_PreRender" Skin="Bootstrap" AllowFilteringByColumn="True" GroupPanelPosition="Top" ShowGroupPanel="True" OnItemDataBound="RadGrid3_ItemDataBound">
           <PagerStyle Mode="NumericPages"></PagerStyle>
           <ClientSettings AllowDragToGroup="True">
           </ClientSettings>
           <MasterTableView DataKeyNames="ID" AllowMultiColumnSorting="True">
               <DetailTables>
                   <telerik:GridTableView DataKeyNames="ID" Name="Short" Width="100%">
                       <DetailTables>
                           <telerik:GridTableView DataKeyNames="ShortUrlID" Name="report" Width="100%">
                               <Columns>
                                   <telerik:GridBoundColumn SortExpression="Domain" HeaderText="Domain"
                                       DataField="Domain">
                                             
                                   </telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn SortExpression="JsonStringReport" HeaderText="JsonStringReport"
                                       DataField="JsonStringReport">
                                             
                                   </telerik:GridBoundColumn>
                                   <telerik:GridTemplateColumn HeaderText="IP">
                                       <ItemTemplate>
                                           <asp:Label ID="Label4" runat="server" Visible="False" Text='<%# Eval("ID") %>'></asp:Label>
                                           <asp:Label ID="lbldomain" runat="server" Visible="False" Text='<%# Eval("Domain") %>'></asp:Label>
  
  
                                           <asp:Label ID="lbljson" runat="server" Text='<%# Eval("JsonStringReport") %>' Visible="False"></asp:Label>
                                           <asp:Label ID="lblIP" runat="server" Text=""></asp:Label>
                                       </ItemTemplate>
                                   </telerik:GridTemplateColumn>
                                   <telerik:GridTemplateColumn HeaderText="DateTimeClick">
                                       <ItemTemplate>
                                           <asp:Label ID="lblClickDate" runat="server" Text=""></asp:Label>
                                       </ItemTemplate>
                                   </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False">
                       <ItemTemplate>
                           <a href="#" data-featherlight="#fl<%# Eval("ID") %>"><em class="icon-eye"></em></a>
                           <div class="lightbox" id='fl<%# Eval("ID") %>'>
                               <div class="col-lg-12">
                                   <!-- START panel-->
                                   <div class="panel panel-default">
                                       <div class="panel-heading">Target Information</div>
                                       <div class="panel-body">
                                           <!-- START table-responsive-->
                                           <div class="table-responsive"> </div>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>
                               </Columns>
                           </telerik:GridTableView>
                       </DetailTables>
                       <Columns>
                           <telerik:GridBoundColumn SortExpression="ShortLinkID" HeaderText="ShortURL ID"
                               DataField="ShortLinkID">
                           </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn SortExpression="Domain" HeaderText="Domain"
                               DataField="Domain">
                           </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn SortExpression="Count" HeaderText="Count"
                               DataField="Count">
                           </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status"
                               DataField="Status">
                           </telerik:GridBoundColumn>
  
  
                           <telerik:GridBoundColumn SortExpression="DateTime" HeaderText="DateTime"
                               DataField="DateTime">
                           </telerik:GridBoundColumn>
                       </Columns>
                   </telerik:GridTableView>
               </DetailTables>
               <Columns>
  
  
                   <telerik:GridBoundColumn SortExpression="TargetName" HeaderText="TargetName"
                       DataField="TargetName">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn SortExpression="TargetDesc" HeaderText="TargetDesc"
                       DataField="TargetDesc">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn SortExpression="Name" HeaderText="Creator" DataType="System.string"
                       DataField="Name">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn SortExpression="DateTime" HeaderText="DateTime"
                       DataField="DateTime">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status"
                       DataField="Status">
                   </telerik:GridBoundColumn>
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 29 May 2015, 07:58 AM
Hello Komeil,

Detailed information on accessing controls in RadGrid in different scenario could be found in the following help article:
As you will notice, the last section refers to hierarchical grid: "Accessing Table Views in a Hierarchical Grid".

Once you get reference to the nested GridTableView object, you can then get reference to an item from that GridTableView and access the corresponding cell of the template column. Finally, in order to find the Label control you could use the FindControl method from the TableCell object. 

One thing to have in mind: In order to access the GridTemplateColumn through the GridDataItem you will have to set the UniqueName property of the column.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
komeil
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or