My requirement : To display the hierarchial items in Radgrid.
Instead of using Nestedview template, thought of using iframe for each grid row.
For example :
===========
Parent record
|
| -->iframe page with child grid
|
|--> iframe page with grand child grid
====================================
For this, my code has single radgrid with one GridTemplateColumn column
Inside that GridTemplateColumn
- created Header template -inside that, table for column headers
- created item template - inside that table for column values
In the first column in the table will be image column, if click on the img, it will open the iframe page and based in the query string am binding the child grid records.
My issue is, i want sorting, filtering for each column inside the header template.
Because of one template column, default filtering option will be one textbox appearing in the grid.
my code is:
<telerik:RadGrid ID="grdparent" runat="server" Width="600px" AutoGenerateColumns="false"
OnNeedDataSource="Needdatasource" ItemStyle-Height="25px" AlternatingItemStyle-Height="25px"
SelectedItemStyle-Height="25px" BorderColor="#009933" BorderWidth="1px" GroupingEnabled="false"
AllowSorting="True" AllowMultiRowSelection="False" AllowFilteringByColumn="True"
AllowPaging="True" GridLines="None" ShowGroupPanel="false" ShowStatusBar="true"
FilterItemStyle-BackColor="#F1F7EE" PageSize="10">
<GroupingSettings CaseSensitive="false" />
<MasterTableView DataKeyNames="ParentID" AllowMultiColumnSorting="false" InsertItemPageIndexAction="ShowItemOnFirstPage"
InsertItemDisplay="Top" GroupLoadMode="Server" ShowHeadersWhenNoRecords="true"
CommandItemDisplay="None" EditMode="PopUp" EnableHeaderContextMenu="false"
CommandItemSettings-AddNewRecordText="Add" AllowAutomaticInserts="false"
AllowFilteringByColumn="True" AllowSorting="true" ExpandCollapseColumn-ButtonType="ImageButton">
<Columns>
<telerik:GridTemplateColumn>
<HeaderTemplate>
<table width="600px" class="mod_content" cellpadding="0" cellspacing="0" border="0">
<tr onclick="selectRow(this);">
<td style="width: 30px">
</td>
<td style="width: 50px">
Parent ID
</td>
<td style="width: 300px">
Parent Name
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="600px" class="mod_content" cellpadding="0" cellspacing="0" border="0">
<tr onclick="activeRow(this);">
<td style="width: 30px">
<a href="#" onclick="return toggleDivDisplay('tr_<%#DataBinder.Eval(Container,"DataItem.ParentID")%>', this, false,'Child.aspx?ParentID=<%#DataBinder.Eval(Container,"DataItem.ParentID")%>' );">
<img src="../images/Expand.gif" alt="Expand/Collapse" id="tr_<%#DataBinder.Eval(Container,"DataItem.ParentID")%>image"
height="14" width="14" border="0" /></a>
</td>
<td style="width: 50px">
<asp:Label ID="lblHdnParentID" runat="server" CssClass="gridlabel" Text='<%#DataBinder.Eval(Container, "DataItem.ParentID")%>'></asp:Label>
</td>
<td style="width: 150px">
<asp:Label ID="lblParentIDName" CssClass="gridlabel" Text='<%# Eval("ParentName") %>'
runat="server"></asp:Label>
</td>
</tr>
<tr style="padding: 0px 0px 0px 0px">
<td colspan="3" style="padding: 0px 0px 0px 0px">
<div id='tr_<%#DataBinder.Eval(Container,"DataItem.ParentID")%>' class="display_false"
style="padding-left: 15px">
<iframe id="tr_<%#DataBinder.Eval(Container,"DataItem.ParentID")%>frame" src="Child.aspx"
frameborder="0" scrolling="yes" height="150" width="100%"></iframe>
</div>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>