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

How to using Scrolling with Nested Template Radgrid

1 Answer 205 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 23 Dec 2010, 07:14 AM
Hi,

I have using Nested Template into RadGrid. but scrolling not working for me. i checked all the ways. but still it's not working.

Here the code what i am using. but i remove the nested template scrolling working fine. can anyone give me suggestion for this one.

I want more important that one.

i have two questions.

1. how to get scrolling when using nestedTemplate into radgrid.
2. how to automatically expand nestedtemplate when have at least one record. otherwise how to disable nested template.

Hi this is very very urgent. please help to me.

Here i send code and screen shot.

  <asp:View ID="vwEarningslist" runat="server">
                   <telerik:RadGrid ID="rgEarningslist" runat="server" DataSourceID="sdsEarningslist" AutoGenerateColumns="False"  AllowSorting="True" GridLines="None" Width="740px" ShowStatusBar="true">
                        
                        <ExportSettings  ExportOnlyData="true" IgnorePaging="True" OpenInNewWindow="true">
                        </ExportSettings>                
                        
                        
                        <MasterTableView  AllowMultiColumnSorting="true" DataKeyNames="CLIENTEARNINGID" Width="100%" CommandItemDisplay="Top">
                            <CommandItemSettings ShowExportToPdfButton="true" ShowExportToCsvButton="false"
                                ShowExportToExcelButton="True" ShowExportToWordButton="false"
                                ShowAddNewRecordButton="False"/>
                            <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="client_earning_id"  MasterKeyField="CLIENTEARNINGID" />
                                    </ParentTableRelation>
                                    <Columns>     
                                        <telerik:GridBoundColumn SortExpression="EARNINGCODE" HeaderText="Code" DataField="EARNINGCODE"  Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="EARNINGDESCRIPTION" HeaderText="Description" DataField="EARNINGDESCRIPTION"  Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                     <telerik:GridBoundColumn SortExpression="TIMECLOCKCODE" HeaderText="Time Clock Code" DataField="TIMECLOCKCODE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn SortExpression="FREQUENCY" HeaderText="Frequency" DataField="FREQUENCY" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn SortExpression="GLNO" HeaderText="GL Number" DataField="GLNO" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn SortExpression="DATATYPE" HeaderText="Data Type" DataField="DATATYPE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="UNITRATE" HeaderText="Unit Rate" DataField="UNITRATE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Taxable?"  ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude WC?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Employer Contribution?"  ></telerik:GridCheckBoxColumn>
                                         <telerik:GridCheckBoxColumn  HeaderText="Employee Contribution?"  ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude Savings?"  ></telerik:GridCheckBoxColumn>                                            
                                           <telerik:GridCheckBoxColumn  HeaderText="Include In AddI Check?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude From Net Calc?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="In/Out?" ></telerik:GridCheckBoxColumn>
                                     </Columns>
                                    <NestedViewTemplate>
                                        <telerik:RadGrid ID="rgEarningChildList" runat="server" Width="675px" DataSourceID="sdsTaxDescription"
                                            AutoGenerateColumns="false" AllowSorting="true" >
                                            <MasterTableView Width="95%" DataKeyNames="client_earning_id"  HeaderStyle-VerticalAlign="Middle">
                                                <NoRecordsTemplate>
                                                    <div align="center" >
                                                        There are no records to display</div>
                                                </NoRecordsTemplate>
                                                <Columns>
                                                     <telerik:GridBoundColumn HeaderText="Location" DataField="REPLOC"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Worksite" DataField="WORKSITE"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Cost Center" DataField="COSTCENTER"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="GL Number" DataField="GLNUM"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Description" DataField="GLDESCRIPTION"></telerik:GridBoundColumn>
                                                </Columns>
                                            </MasterTableView>
                                            <HeaderStyle Wrap="false" />                   
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true"/>
                        </ClientSettings>
                                        </telerik:RadGrid>
                                    </NestedViewTemplate>
                        </MasterTableView>     
                        <HeaderStyle Wrap="false" />                   
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true"/>
                        </ClientSettings>
                    </telerik:RadGrid>
                             
            </asp:View>

Thanks in Advance,
Dhamu.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Dec 2010, 09:22 AM
Hello Dhamu,

Try to set scroll height for grid's child table and check whether it works.

ASPX:
<ClientSettings>
    <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="150px"   />
</ClientSettings>

Also go through the following code library which explains how to set scrolling for each table in a Hierarchical Grid.
Separate scrolls for inner tables in hierarchical grid

You can try the following code snippet to expand NestedViewTemplate when there is only one record.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnPreRender="RadGrid1_PreRender1">
    <MasterTableView DataKeyNames="EmployeeID">
        <Columns>
           . . . . . .
        </Columns>
        <NestedViewTemplate>
            <telerik:RadGrid ID="RadGrid2" runat="server">
                 . . . . . . .
            </telerik:RadGrid>
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_PreRender(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 == 1)
           {
               GridDataItem parentitem = (GridDataItem)item.ParentItem;
               parentitem.Expanded = true;
            }
           else
               grid.Enabled = false;
       }
   }

Thanks,
Princy.
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or