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

Display Grid Pagination.

4 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
giridhar
Top achievements
Rank 1
giridhar asked on 18 Feb 2009, 05:16 AM

Hi,
  As per Current requirement I am using pager template which displays numeric pager at the bottom. I am displaying 10 records in grid and numericPagerControl with page button count 10 .

 

Problem: Whenever number of records to be displayed in grid is less than 10, Grid data is occuyping less hieght and pagination is moving to top. To elaborate, Suppose Grid displays 2 records, immediately after 2 records pagination bar is appearing. Instead I want 8 empty records to be shown and then display the pagination bar. appendong cod efor your convinence.

    
            <Rad:RadGrid ID="UserGridCE" AllowPaging="true" OnPageIndexChanged="UserGridCE_PageIndexChanged" 
                EnableViewState="true" AllowMultiRowEdit="true" Skin="Vista" EnableEmbeddedSkins="false" 
                ShowHeader="true" runat="server" AllowSorting="true" OnSortCommand="UserGridCE_SortCommand" 
                OnPreRender="UserGridCE_PreRender" 
                Width="100%" GridLines="None" OnColumnCreated="UserGridCE_ColumnCreated" OnItemCreated="UserGridCE_ItemCreated" 
                AutoGenerateColumns="false" OnItemCommand="UserGridCE_ItemCommand" OnItemDataBound="UserGridCE_ItemDataBound">  
                <PagerStyle Visible="true" AlwaysVisible="true"/>  
                <MasterTableView AllowPaging="true" AllowCustomPaging="true" AllowCustomSorting="true" 
                    AllowNaturalSort="false" AllowSorting="true" DataKeyNames="Activity_PK" Width="100%">  
                    <SortExpressions> 
                        <rad:GridSortExpression FieldName="0" SortOrder="Ascending" /> 
                    </SortExpressions> 
                    <Columns> 
                        <Rad:GridTemplateColumn SortExpression="0" HeaderText="<%$ Resources:L_LMS_User_ExceptionDetail, Info_Name%>" 
                            UniqueName="ActivityName">  
                            <ItemStyle/> 
                            <ItemTemplate> 
                                <asp:Label ID="Label3" runat="server" ToolTip='<%# GetActName(Eval("ActivityName"),Eval("Activity_PK"))%>' 
                                    Text='<%# GetActName(Eval("ActivityName"),Eval("Activity_PK"))%>'></asp:Label> 
                            </ItemTemplate> 
                        </Rad:GridTemplateColumn> 
                        <Rad:GridTemplateColumn HeaderText="<%$ Resources:L_LMS_User_ExceptionDetail, Info_RequiredCredits%>" 
                            UniqueName="RequiredCredits">  
                            <ItemStyle/> 
                            <ItemTemplate> 
                                <%# Eval("RequiredCredits")  %> 
                            </ItemTemplate> 
                        </Rad:GridTemplateColumn> 
                        <Rad:GridTemplateColumn HeaderText="<%$ Resources:L_LMS_User_ExceptionDetail, Info_AcquiredCredits%>" 
                            UniqueName="AcquiredCredits">  
                            <ItemStyle/> 
                            <ItemTemplate> 
                                <%# Eval("AcquiredCredits")%> 
                            </ItemTemplate> 
                        </Rad:GridTemplateColumn> 
                        <Rad:GridTemplateColumn HeaderText="<%$ Resources:L_LMS_User_ExceptionDetail, Info_Progress%>" 
                            UniqueName="Progress">  
                            <ItemStyle /> 
                            <ItemTemplate> 
                                <%# GetProgressBarX(Eval("Activity_PK"), GetProgress(Eval("RequiredCredits"), Eval("AcquiredCredits")), "small")%> 
                            </ItemTemplate> 
                        </Rad:GridTemplateColumn> 
                    </Columns> 
                              <PagerTemplate> 
                                    <table class="pagerTable">  
                                        <tr class="pagerTable">  
                                            <td class="pagerCountCell">  
                                            </td> 
                                            <td class="pagerNumbersCell">  
                                                <div> 
                                                    <table class="pagerCellBorder">  
                                                        <tr class="pagerCellBorder">  
                                                            <td class="pagerCellBorder">  
                                                                <div class="GridPageChangerDiv">  
                                                                    <asp:LinkButton ID="previous" runat="server" Text="Previous" CommandName="Page" 
                                                                    CausesValidation="false" CssClass="GridPageChangerText" 
                                                                    CommandArgument="Prev"/>  
                                                                </div> 
                                                            </td> 
                                                            <td class="pagerCellBorder">  
                                                                <asp:ImageButton ID="previousImage" runat="server" CommandName="Page" 
                                                                    ImageUrl="~/client/media/images/_common/pagination-left.gif" ImageAlign="Bottom" 
                                                                    CausesValidation="false" 
                                                                    CommandArgument="Prev"/>  
                                                            </td> 
                                                            <td class="pagerCellBorder">  
                                                                <asp:Panel runat="server" ID="NumericPagerPlaceHolder"/>  
                                                            </td> 
                                                            <td class="pagerCellBorder">  
                                                                <asp:ImageButton ID="nextImage" runat="server" CommandName="Page" 
                                                                    ImageUrl="~/client/media/images/_common/pagination-right.gif" ImageAlign="Bottom" 
                                                                    CausesValidation="false" 
                                                                    CommandArgument="Next"/>  
                                                            </td> 
                                                            <td class="pagerCellBorder">  
                                                                    <div class="GridPageChangerDiv">  
                                                                        <asp:LinkButton ID="next" runat="server" Text="Next" CommandName="Page" 
                                                                        CausesValidation="false" CssClass="GridPageChangerText" 
                                                                        CommandArgument="Next"/>  
                                                                    </div> 
                                                            </td> 
                                                       </tr> 
                                                    </table> 
                                                 </div> 
                                            </td> 
                                            <td class="pagerCountCell comboIntroTextLineRight">  
                                                <div class="pagerDiv">  
                                                    <asp:Label ID="lblRecCount" runat="server" Text=""></asp:Label> 
                                                </div> 
                                            </td> 
                                        </tr> 
                                   </table> 
                              </PagerTemplate> 
                          </MasterTableView> 
                          <PagerStyle Mode="numericPages" PageButtonCount="10" Position="Bottom" /> 
                <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">  
                    <Selecting AllowRowSelect="True"></Selecting> 
                    <Resizing AllowColumnResize="true" /> 
                    <ClientEvents OnColumnResizing="ColumnResizing_UserGridCE" />    
                </ClientSettings> 
            </Rad:RadGrid> 

Any solution to the problem would be a great favour.

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 18 Feb 2009, 07:22 AM
Hello giridhar,

This is default behavior of RadGrid. It will show only the records provided in its data source.
If you need to have additional rows you should add them to RadGrid data source manually before bind it.

However if you need to have RadGrid with fixed height you can set it Height property.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
giridhar
Top achievements
Rank 1
answered on 18 Feb 2009, 07:27 AM
Hi Nikolay,
     Sorry I forgot to mention one more key point.
Grid displays 10 records in first page, then shows pagination control. But on last page there are few records. Suppose there are 2 records then it is showing 2 records and moving pagination control up.

Position change of pagination control is not expected behavious. Pagination control should stay at the static place as user navigates through rad grid pages.

how can we achive this in Radgrid?

Is data populating only way? I tried settig height, but could not get it.

Thanks,
Giridhar.
0
giridhar
Top achievements
Rank 1
answered on 18 Feb 2009, 09:34 AM
Please do let me now if there is any other solution to problem, apart from populating empty rows.
0
Nikolay Rusev
Telerik team
answered on 20 Feb 2009, 02:44 PM
Hello Giridhar,

As I suggested in my previous post if you don't need RadGrid height to change you should set RadGrid.Height property with fixed size.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
giridhar
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
giridhar
Top achievements
Rank 1
Share this question
or