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

Grid Height and Scrolling problem.

2 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohsin
Top achievements
Rank 1
Mohsin asked on 11 Oct 2011, 01:11 PM
Hi Telerik Team,

I am having problem of grid height and scrolling. 
When I increase height of grid as well as mastertable view height with allowscroll= true it ran fine, but when I perform any search on grid with my custom search it filter record fine but it make the mastertable view height to default.
For example if i set grid height = 600px and mastertable view htight = 600px and perform any search it display search result with default height of mastertable view. 
If I define scrolling height = 600px and perform any search, lets say it returns 2 records, the grid will show those records in whole grid, like one record will occupy 300px height and other will occupy 300px height.

Please note that I using RadAjaxManager.

Following are the code of my ascx file:

<telerik:RadGrid ID="radCTAFund" runat="server" GridLines="None" AllowSorting="True"
                    OnNeedDataSource="radCTAFund_NeedDataSource" OnItemDataBound="radCTAFund_ItemDataBound"
                     CellSpacing="0" Width="100%">
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="false"/>
                            </ClientSettings>
                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="FundRaiseID" runat="server"
                                AllowSorting="true" ItemStyle-Font-Size="8pt" 
                            AlternatingItemStyle-Font-Size="8pt" Width="100%" >
                                <CommandItemSettings ExportToPdfText="Export to PDF" />
                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridTemplateColumn DataField="FundRaiseName" HeaderText="CTA Name" 
                                        SortExpression="FundRaiseName" UniqueName="FundRaiseName">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkCTAFund" runat="server" Font-Bold="true"><%# DataBinder.Eval(Container.DataItem, "FundRaiseName")%></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                        <HeaderStyle Width="200px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="OneMonth" HeaderText="One Month" 
                                        SortExpression="OneMonth" UniqueName="OneMonthNew">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_one_month" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                      <HeaderStyle Width="50px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="YearToDate" HeaderText="Year To Date" 
                                        SortExpression="YearToDate" UniqueName="YearToDate">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_year_to_date" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                       <HeaderStyle Width="50px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="LastTwelveMonths" 
                                        HeaderText="Ann. Avg" SortExpression="LastTwelveMonths" 
                                        UniqueName="LastTwelveMonths">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_last_twelve_months" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                        <HeaderStyle Width="50px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="OneYearDrawdown" 
                                        HeaderText="Max Avg. Drawdown" SortExpression="OneYearDrawdown" 
                                        UniqueName="OneYearDrawdown">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_one_year_drawdown" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                        <HeaderStyle Width="70px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="StandardDeviation" 
                                        HeaderText="Std. Dev" SortExpression="StandardDeviation" 
                                        UniqueName="StandardDeviation">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_StandardDeviation" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                        <HeaderStyle Width="50px"/>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="MinimumAccount" 
                                        HeaderText="Min.<br> Acct" SortExpression="MinimumAccount" 
                                        UniqueName="MinimumAccount">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_minimum_account" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="AUM" HeaderText="AUM" 
                                        SortExpression="AUM" UniqueName="AUM" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_AUM" runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Font-Bold="True" />
                                    </telerik:GridTemplateColumn>
                            
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>
                                <ItemStyle Font-Size="8pt" />
                                <AlternatingItemStyle Font-Size="8pt" />
                        
                            </MasterTableView>
                            <PagerStyle Mode="NumericPages" />
                             <FilterMenu EnableImageSprites="False">
                            </FilterMenu>
                            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                            </HeaderContextMenu>
                        </telerik:RadGrid>


Urgent response will be appreciated. 

Regards,
Mohsin

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 14 Oct 2011, 11:59 AM
Hi Mohsin,

Note that when you have grid with scrolling enabled to set the height of the control's scrollable area you should use RadGridInstance.ClientSettings.Scrolling.ScrollHeight property. You can refer to the help article below for more information about Height vs ScrollHeight:
http://www.telerik.com/help/aspnet-ajax/grid-height-vs-scrollheight.html

I also followed your scenario and prepared a sample project which is working properly. Give it a  try and see if it helps.

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Mohsin
Top achievements
Rank 1
answered on 01 Nov 2011, 10:54 AM
Hi Pavlina,

The attached example really helped me out. It solved my problem.
I was applying grid height and mastertableview height as well as scroll height but didn't placed TableLayout="Fixed" that was causing issue. Now it's working perfactly.
Thank's Pavlina.

Regards,
Mohsin
Tags
Grid
Asked by
Mohsin
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Mohsin
Top achievements
Rank 1
Share this question
or