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

Fixed number of lines on each page (PageSize), even last one

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nicolas
Top achievements
Rank 1
Nicolas asked on 10 Feb 2009, 09:58 AM
Hi,

I'm using a RadGrid with a fixed height in pixels. I've set the MasterTableView's AllowPaging property to "true" and the PageSize property to "19" (because I want to display 19 rows on each page).

My problem is that when I reach last page, which does not contain 19 elements (unless the total is a multiple of 19 but hey), then on that page the rows take all the available space in height. For example, if a page contains only 2 elements, I'm getting 2 rows each taking 50% of the total height.

Obviously what I would like is the rows height to stay the same accross the pages (I tried setting ItemStyle-Height to a fixed dimension but did not change anything). So, if I have a page with 2 rows, knowing that the PageSize is set to 19, I would like my 2 rows to be followed by the equivalent of 17 empty rows in height.

How can I achieve this?

Hope that makes sense.

Thanks,
Nicolas


------
Just for clarity sake:

- What I have (1st page on the left, 2nd page on the right, assuming PageSize=19 and I have a total of 20 rows):

------------------------------                -------------------------- 
header 
------------------------------                header 
row1 
------------------------------                -------------------------- 
row2 
------------------------------                row20 
... 
------------------------------                -------------------------- 
row19 
------------------------------                pager 
pager 
------------------------------                -------------------------- 

- What I would like:

--------------------------                -------------------------- 
header                                    header 
--------------------------                -------------------------- 
row1                                      row20 
--------------------------                --------------------------  
row2 
--------------------------                empty space not selectable  
...                                                 here 
-------------------------- 
row19 
--------------------------                -------------------------- 
pager                                     pager 
--------------------------                -------------------------- 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Feb 2009, 01:35 PM
Hello Nicolas,

Try setting the Scrolling property for the grid as shown below to achieve your scenario:
aspx:
 <telerik:RadGrid ID="RadGrid1" AllowPaging="true" PageSize="19"  AutoGenerateColumns="true" DataSourceID="SqlDataSource1" runat="server" > 
      <MasterTableView>        
        <Columns> 
          ..... 
        </Columns> 
        </MasterTableView> 
        <ClientSettings> 
        <Scrolling AllowScroll="true" UseStaticHeaders="true"/> 
        </ClientSettings> 
 </telerik:RadGrid> 

Thanks
Princy.
0
Nicolas
Top achievements
Rank 1
answered on 10 Feb 2009, 02:06 PM
Hi,

thank you for your response.

Here is the full definition of my  grid :

<telerik:RadGrid ID="grid_DataSources" runat="server" 
                             AutoGenerateColumns="true" 
                             DataKeyNames="RecId" 
                             Skin="WebBlue" 
                             DataSourceID="DataSource1" 
                             Height="518px" 
                             Width="198px" 
            > 
            <MasterTableView  
                DataKeyNames="RecId"  
                AllowPaging="true"  
                height="518px"  
                PageSize="19"  
                PagerStyle-AlwaysVisible="true"  
                PagerStyle-Mode="NumericPages"  
                CommandItemDisplay="Bottom" 
            > 
             
            
            </MasterTableView> 
             
            <ClientSettings EnablePostBackOnRowClick="false"
                <Selecting AllowRowSelect="true" /> 
                <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
                <ClientEvents OnRowClick="" /> 
            </ClientSettings> 
             
</telerik:RadGrid> 

Running this (with scrolling enabled) results in this weird behavior.

If I set AllowScroll back to "false", here is what I obtain (do not pay attention to columns width, that's because I removed mine and set AutoGenerate for the example). You can see here the last page which I'm trying to fix.

Thank you,
Nicolas

Tags
Grid
Asked by
Nicolas
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nicolas
Top achievements
Rank 1
Share this question
or