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

Have a 100% height grid with a scrollbar

4 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 09 Jun 2011, 09:59 PM
Hi guy,

Just want to know if it is possible to have a radGrid with his height set to 100% and with a scrollbar, because everytime I tried, it really don't work. By exemple, I took this example and I put the height of the grid to 100% and it start f*** up. Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head id="Head1" runat="server">
</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post">
       <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
 
        <br />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox3">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox4">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="DropDownList1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" ShowFooter="True" GridLines="None"
            AllowSorting="True" Width="750px" Height="100%" runat="server" AutoGenerateColumns="false">
            <PagerStyle Mode="NumericPages" />
            <MasterTableView Width="100%">
                <Columns>
                    <telerik:GridBoundColumn UniqueName="ProductID" DataField="ProductID" HeaderText="ProductID"
                        SortExpression="ProductID" Aggregate="Count" />
                    <telerik:GridBoundColumn UniqueName="ProductName" DataField="ProductName" HeaderText="ProductName"
                        SortExpression="ProductName" Aggregate="None" />
                    <telerik:GridBoundColumn UniqueName="QuantityPerUnit" DataField="QuantityPerUnit"
                        HeaderText="Quantity Per Unit" SortExpression="QuantityPerUnit"/>
                    <telerik:GridNumericColumn Aggregate="Avg" DataField="UnitPrice" HeaderText="Unit price"
                        SortExpression="UnitPrice" UniqueName="UnitPrice" DataFormatString="{0:C}"
                        FooterAggregateFormatString="Avg: {0:C}" />
                    <telerik:GridNumericColumn Aggregate="Sum" DataField="UnitsInStock" HeaderText="In Stock"
                        SortExpression="UnitsInStock" UniqueName="UnitsInStock" />
                    <telerik:GridNumericColumn Aggregate="Max" DataField="UnitsOnOrder" HeaderText="Units On Order"
                        SortExpression="UnitsOnOrder" UniqueName="UnitsOnOrder" />
                </Columns>
            </MasterTableView>
            <HeaderStyle Width="200px" />
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                </Scrolling>
            </ClientSettings>
        </telerik:RadGrid>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 20 ProductID, ProductName, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder FROM Products"
            runat="server"></asp:SqlDataSource>
    </form>
</body>
</html>


So, anyone have a solution to correct this problem ?
Thank you

David Lefaivre-B.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Jun 2011, 08:23 AM
Hello David,

This sample project in this code library demonstrates how to configure r.a.d.grid to occupy 100% height of its container with scrolling and static headers enabled. Give it a try and see if it works for you.

Greetings,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start 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
David
Top achievements
Rank 1
answered on 10 Jun 2011, 02:28 PM
Hi Pavlina

Thank you, it's help me. But I still have a question. Is it possible to set a minimum width or height for the grid, because the grid take the 100% of the window in width, but if you have a very lilttle window, all the column will be compress and it will be impossible to read. So, is it possible to set a minimum witdth, like by example 500px ?
Thank you

David

PS: Or it is possible to set a fixed size to the window, but only for the width. So, the user can still resize the window in height, but not in width
0
David
Top achievements
Rank 1
answered on 13 Jun 2011, 03:45 PM
Nevermind, it was a pretty stupid question. Just have to set a value to my column, not to the entire grid. 
0
Pavlina
Telerik team
answered on 14 Jun 2011, 09:11 AM
Hi David,

I am glad you were able to find a solution. Do not hesitate to let us know if you have any other questions.

All the best,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start 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.

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