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

how to hide expand cell when record not found

4 Answers 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 30 Nov 2010, 01:51 PM
Hi,
I am using NestedViewTemplate in my application. but i want hide expand Image when record not found cells only.

given code i am using now. please give me a tips for this one.

<telerik:RadGrid ID="gvAddPlans" runat="server" AutoGenerateColumns="False" DataSourceID="sdsDispayPlans" OnPreRender="gvAddPlans_PreRender"
                        Width="740px" GridLines="Both">
                        <MasterTableView  HierarchyDefaultExpanded="false" AutoGenerateColumns="false"
                            CommandItemDisplay="Top" DataKeyNames="sp_pln_id">
                            <NoRecordsTemplate>
                                <div align="center">
                                    There are no records to display</div>
                            </NoRecordsTemplate>                           
                                </div>
                            <Columns>
                            ----------------------------------------------
                            ------------------------------------------------
                            </Columns>
                            <NestedViewTemplate>
                                <telerik:RadGrid ID="rgFlex" runat="server" AutoGenerateColumns="False" OnItemDataBound="rgFlex_OnItemDataBound" DataSourceID="sdsFlexBenefit"
                                    Width="700px" GridLines="Both">
                                    <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top">
                                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                                      
                                        <Columns>
                                         ----------------------------------------------
                                             ------------------------------------------------
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid>
                            </NestedViewTemplate>
                        </MasterTableView>
                    </telerik:RadGrid>


Thanks,
Dhamu

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 30 Nov 2010, 04:14 PM
Hello Dhamu,

More information about how to hide the expand/collapse images when there are not records under parent grid item is available in the following link:
Hiding expand/collapse images when no records

Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Dhamodharan
Top achievements
Rank 1
answered on 30 Nov 2010, 04:19 PM
Hi,

Given example not using two grids.

but i am using two grids that is called nested template. before that i tried that code. but it is not working for me.

please give me any other solution.

Thanks,
Dhamu.
0
Princy
Top achievements
Rank 2
answered on 01 Dec 2010, 11:45 AM
Hello Dhamu,

Give a try with the following code snippet to hide the Exapand/Collapse image when there is no record in RadGrid inside NestedViewTemplate.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnPreRender="RadGrid1_PreRender1">
    <MasterTableView DataKeyNames="EmployeeID">
        <Columns>
           . . . . . .
        </Columns>
        <NestedViewSettings>
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="EmployeeID" MasterKeyField="EmployeeID" />
            </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
            <telerik:RadGrid ID="RadGrid2" runat="server">
                 . . . . . . .
            </telerik:RadGrid>
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_PreRender1(object sender, EventArgs e)
   {
      foreach (GridNestedViewItem item in RadGrid1.MasterTableView.GetItems(GridItemType.NestedView)) // loop through the nested items of a NestedView Template
       {
           RadGrid grid = (RadGrid)item.FindControl("RadGrid2");
           if (grid.Items.Count == 0)
           {
               GridDataItem parentitem = (GridDataItem)item.ParentItem;
               TableCell cell = parentitem ["ExpandColumn"];
               cell.Controls.Clear();
           }
       }
   }

Thanks,
Princy.
0
Smiely
Top achievements
Rank 1
answered on 10 Jun 2011, 04:25 PM
Princy .... u r THE greatest!!
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Dhamodharan
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Smiely
Top achievements
Rank 1
Share this question
or