I want to hide the expand/collapse images in hierarchical radgird when there are no records, i tried the method provided in the help link but that's not working for me it hides all the expand/collapse buttons independent of wheather the records is there or not.
http://www.telerik.com/help/aspnet-ajax/grdhideexpandcollapseimageswhennorecords.html
I am building 3 levele hierarchical grid, manually i am building the tables and setting and binding the datasource at the server. kindly advise how to hide expand/collapse images in my case, Thanks in advance. below is my code.
<telerik:RadTabStrip ID="radtabstpPatientView" SelectedIndex="0" runat="server" MultiPageID="radmltpgPatientView"
Skin="CustomTabStripSkin" CssClass="clsLabel" EnableEmbeddedSkins="false" >
<Tabs>
<telerik:RadTab Text="Patient Chronology" PageViewID="PatChronology">
</telerik:RadTab>
</Tabs>
<Tabs>
<telerik:RadTab Text="Balance Summary" PageViewID="BalSummary">
</telerik:RadTab>
</Tabs>
<Tabs>
<telerik:RadTab Text="Unapplied Payment Details" PageViewID="UnappliedPayDet">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="radmltpgPatientView" runat="server" SelectedIndex="0" CssClass="clsLabel">
<telerik:RadPageView ID="radpgviewPatChronology" runat="server">
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" Skin="Office2007" runat="server" Width="95%" AutoGenerateColumns="False"
PageSize="7" AllowSorting="True" AllowPaging="True" GridLines="None" ShowStatusBar="true" AllowMultiRowSelection="true" >
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView AllowMultiColumnSorting="True" DataKeyNames="dt1Id,Type" Width="100%" EnableNoRecordsTemplate="false" >
<Columns>
<telerik:GridBoundColumn SortExpression="dt1Id" HeaderText="DTID" HeaderButtonType="TextButton"
DataField="dt1Id" Resizable="True" Reorderable="True" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Type" HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Date" HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
</Columns>
<DetailTables >
<telerik:GridTableView Caption="" AllowSorting="false" DataKeyNames="dt1Id" Width="100%" ShowHeader="false" EnableNoRecordsTemplate="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="dt1Id" MasterKeyField="dt1Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText="dt1Id" HeaderButtonType="TextButton"
DataField="dt1Id" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type">
<ItemStyle Width="207px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date">
<ItemStyle Width="67px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton id="imgbtn" imageurl="~/Images/btn_Edit.gif" runat="server" visible= <%# DataBinder.Eval(Container.DataItem, "Status")%>>
</asp:ImageButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView Caption="" AllowSorting="false" DataKeyNames="dt1Id" Width="100%" ShowHeader="false" EnableNoRecordsTemplate="false" >
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="dt1Id" MasterKeyField="dt1Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText="dt1Id" HeaderButtonType="TextButton"
DataField="dt1Id" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type">
<ItemStyle Width="207px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date">
<ItemStyle Width="67px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton id="imgbtn" imageurl="~/Images/btn_Edit.gif" runat="server" visible= <%# DataBinder.Eval(Container.DataItem, "Status")%>>
</asp:ImageButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
This is the way iam setting and bindiing the datasoruce for the grid
RadGrid1.MasterTableView.DataSource = dtTable1
RadGrid1.MasterTableView.DetailTables(0).DataSource = dtTable2
RadGrid1.MasterTableView.DetailTables(0).DetailTables(0).DataSource = dtTable3
RadGrid1.DataBind()
The table structures are as below
dtTable1.Columns.Add(
"dt1Id")
dtTable1.Columns.Add(
"Type")
dtTable1.Columns.Add(
"Date")
dtTable1.Columns.Add(
"EmptyColumn")
dtTable1.Columns.Add(
"Description")
dtTable1.Columns.Add(
"Status")
dtTable2.Columns.Add(
"dt1Id")
dtTable2.Columns.Add(
"Type")
dtTable2.Columns.Add(
"Date")
dtTable2.Columns.Add(
"EmptyColumn")
dtTable2.Columns.Add(
"Description")
dtTable2.Columns.Add(
"Status")
dtTable3.Columns.Add(
"dt1Id")
dtTable3.Columns.Add(
"Type")
dtTable3.Columns.Add(
"Date")
dtTable3.Columns.Add(
"EmptyColumn")
dtTable3.Columns.Add(
"Description")
dtTable3.Columns.Add(
"Status")
Regards,
Santhosh