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

RadGrid maintains static height when no data available

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

Please find the attached image below.
I am using radgrid to show data from database.I only need show scrolling when the height exceeds 300px when data available.
But the grid maintains the same height 300px even when no data available or with empty space when less data available.
(I dont want to show empty space when no enough data available for Grid)

I used the below code in HTML.
<telerik:RadGrid ID="RadGridWebsiteVisit" runat="server" GridLines="None" AutoGenerateColumns="False"
                            Width="450px" Skin="Black" OnNeedDataSource="RadGridWebsiteVisit_NeedDataSource"
                            AllowSorting="True">
                            <%--<PagerStyle Mode="NumericPages"></PagerStyle>--%>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="300px" />
                            </ClientSettings>
                            <MasterTableView DataKeyNames="Rank">
                                <RowIndicatorColumn Visible="false">
                                </RowIndicatorColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="Rank" UniqueName="Rank" HeaderText="Rank" HeaderStyle-HorizontalAlign="Left"
                                        ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="80px" ItemStyle-Width="80px">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="BaseURL" HeaderText="Website" ReadOnly="True" ItemStyle-Wrap="true"
                                        UniqueName="BaseURL" HeaderStyle-Width="250px" ItemStyle-Width="300px" HeaderStyle-HorizontalAlign="Left"
                                        ItemStyle-HorizontalAlign="Left">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="UrlCount" HeaderText="Visits" ReadOnly="True"
                                        UniqueName="UrlCount" HeaderStyle-Width="50px" ItemStyle-Width="100px" HeaderStyle-HorizontalAlign="Left"
                                        ItemStyle-HorizontalAlign="Left">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>

Please help to solve this urgently.

Thanks,
Dhamodharan.

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Oct 2011, 05:53 PM
Hello,

<style type="text/css">
       .RadGrid .rgDataDiv
       {
           height : 100% !important;
           max-height : 300px !important;
       }
   </style>

let me know if any concern.

Thanks,
Jayesh Goyani
0
dhamo
Top achievements
Rank 1
answered on 03 Oct 2011, 03:30 PM
Thanks Jayesh. It works fine.
Tags
Grid
Asked by
dhamo
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
dhamo
Top achievements
Rank 1
Share this question
or