Page Size / PageSizes Problem

14 posts, 0 answers
  1. Justin
    Justin avatar
    4 posts
    Member since:
    May 2013

    Posted 24 May 2013 Link to this post

    Hi All,

    this is my first post here, but I'm having a problem with the PageSizes setting for a grid.

    Here is my markup for the Pager:
    <PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="{1, 10, 20, 50, 100, 200, 250}" />


    And attached is an image showing what this produces (the grid has been removed because of client info).

    As you can see, the first and last options are not present in the dropdown.  Why is this?

    My second question would be this:  If I wanted (site-wide) to have 10,20, 50, 100, 200 as my page sizes, and 50 as the default...is there a way to do that without modifying all grids in my system individually?

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 26 May 2013 Link to this post

    Hello,

    Please create one skin file and add below code line in it.
    <telerik:RadGrid  runat="server"  PageSize="50"  AllowPaging="true">        </telerik:RadGrid>

    Please check below link to customize page size comboBox.
    http://jayeshgoyani.blogspot.in/2012/06/customizing-items-of-radgrid-page-size.html

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Justin
    Justin avatar
    4 posts
    Member since:
    May 2013

    Posted 26 May 2013 Link to this post

    Hi!  Thanks for the answers.

    A couple of followups:

    1. So the PageSizes property inside the asp does not function correctly?  I need to do it programatically like the blog post outlines?

    2. I've done some looking at the skinning documentation (we are just using the default) and I don't see how creating a skin for RadGrid would change the default behavior of the combo box site wide.  Maybe I am just misunderstanding what you mean.

    Thanks!
    Justin
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 May 2013 Link to this post

    Hi Justin,

    I suppose you want to programmatically set the page size,please have a look at this code.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
           if (e.Item is GridPagerItem)
           {
               RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
     
               PageSizeCombo.Items.Clear();
               PageSizeCombo.Items.Add(new RadComboBoxItem("10"));
               PageSizeCombo.FindItemByText("10").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);
               PageSizeCombo.Items.Add(new RadComboBoxItem("20"));
               PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);
               PageSizeCombo.Items.Add(new RadComboBoxItem("50"));
               PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);
               PageSizeCombo.Items.Add(new RadComboBoxItem("100"));
               PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);
               PageSizeCombo.Items.Add(new RadComboBoxItem("200"));
               PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);
               PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
           }
       }

    ASPX:
    <telerik:RadGrid ID="RadGrid1"  AllowPaging="True" PageSize="50" runat="server" OnItemDataBound="RadGrid1_ItemDataBound">
        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
      </telerik:RadGrid>


    Thanks
    Princy
  6. Justin
    Justin avatar
    4 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    Hi Princy,

    Thanks for the answer, but the first response already explained (in the blog post) how to do it programatically.  So I don't need that.  What I would really like to know is why the PageSizes attribute doesn't work the way it should.

    If you look at the original post I made, you will see that it sort-of works, but it leaves off the first and last options.  Is this intended?  I can't find any real documentation on this attribute.

    Thanks,
    Justin
  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 May 2013 Link to this post

    Hello Justin,

    The format of writing the PageSize is shown below,try removing the curly braces{..},please try this.

    ASPX:
    <PagerStyle Mode="NextPrevAndNumeric" PageSizes="1,10,20,30,40,50"/>

    Thanks,
    Princy
  8. Justin
    Justin avatar
    4 posts
    Member since:
    May 2013

    Posted 29 May 2013 Link to this post

    Hi Princy,

    Thank you!  I'm going to give that a try and see what happens.  Now my other question had to do with how to set this up as the default pagesize dropdown for every radgrid in my system.  Someone above mentioned using a skin for this.  How would I use a skin to accomplish that?  

    Thanks!
    Justin
  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 May 2013 Link to this post

    Hi Justin,

    As far as i know we cant set any skin for pager,but we can set the CSS for that pager combobox.Every skin contains,its own style,so with that, inorder to set color for the pager combobox,we should give CSS.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" AllowPaging="True" PageSize="10"  Skin="Web20">
      <PagerStyle PageSizeControlType="RadComboBox" > </PagerStyle>
    </telerik:RadGrid>

    CSS:
    div.RadGrid .RadComboBox td
    {
        background-color: green;
        background-image: none;
        border: 0 none;
    }

    Thanks,
    Princy
  10. Kyle
    Kyle avatar
    23 posts
    Member since:
    Jun 2013

    Posted 13 Jun 2013 Link to this post

    The PageSizes Attribute is not working for me as well:

     

     

    <telerik:RadGrid AutoGenerateColumns="false" ID="rgSearch"

     

     

     

    AllowFilteringByColumn="True" AllowPaging ="true" AllowSorting="true"

     

     

     

    runat="server" PageSize="50" onneeddatasource="rgSearch_NeedDataSource" Skin="WebBlue" >

     

     

     

     


    <
    PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="5,10,25,50,100,250" />

     

    <

     

     

    MasterTableView TableLayout="Auto" AllowMultiColumnSorting="true">

     

     

     

    <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"></CommandItemSettings>

     

     

     

    <Columns>
      ...

     

     

     

    </Columns>

     

     

     

     

     

     

     

    </MasterTableView>

     

     

     

     

     

     

     

    <ExportSettings ExportOnlyData="false" OpenInNewWindow="true" HideStructureColumns="true">

     

     

     

     

     

     

     

    <Excel Format="Biff" />

     

     

     

     

     

     

     

    </ExportSettings>

     

     

     

     

     

     

     

     

    </telerik:RadGrid>

     

  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Jun 2013 Link to this post

    Hi Kyle,

    You have placed the PagerStyle property out of MasterTableView,thats why,it takes the default value.Please set it after the MasterTableView.

    ASPX:
    <telerik:RadGrid AutoGenerateColumns="false" ID="rgSearch" AllowFilteringByColumn="True"
                AllowPaging="true" AllowSorting="true" runat="server" PageSize="50" Skin="WebBlue">           
          <MasterTableView TableLayout="Auto" AllowMultiColumnSorting="true">
                <PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="5,10,25,50,100,250" />
                    <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" />
                <Columns>
    . . . . . . . . .
    . . . . . . . . .
                </Columns>
          </MasterTableView>          
    </telerik:RadGrid>

    Thanks,
    Princy
  12. Kyle
    Kyle avatar
    23 posts
    Member since:
    Jun 2013

    Posted 14 Jun 2013 Link to this post

    And just like that, it works!   Couldn't find any examples of this in the demos . . . thanks very much for the help!
  13. Kasun
    Kasun avatar
    1 posts
    Member since:
    May 2015

    Posted 19 May 2015 in reply to Princy Link to this post

    The PageSizes Attribute is not working for me  

    <telerik:RadGrid ID="grdJobList" runat="server" GridLines="None" Skin="Outlook" AllowPaging="true"
                    AllowSorting="True" 
                    OnNeedDataSource="RadGridStockRecevedStatus_NeedDataSource" PageSize="50"
                    AllowFilteringByColumn="True" OnDeleteCommand="grdJobList_DeleteCommand" 
                    OnItemCommand="grdJobItem_ItemCommand">
                    <GroupingSettings CaseSensitive="false"  />
                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="Id,JobType,DepartmentCode"
                        CommandItemDisplay="Top">
                        <PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="5,10,25,50,100,250" />
                        <CommandItemTemplate>
                            <asp:Button ID="BtnCSV" runat="server" CssClass="btnGridAddItm" CommandName="ExportToCsv"
                                Text="Export to CSV"></asp:Button>
                        </CommandItemTemplate>
                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>

     </Columns>

  14. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 20 May 2015 in reply to Kasun Link to this post

    Hello Kasun,

    It would be nice if you can provide telerik DLL version.

    Thanks, 

    Jayesh Goyani

  15. Sony
    Sony avatar
    2 posts
    Member since:
    Mar 2015

    Posted 20 Nov 2015 Link to this post

    http://stackoverflow.com/questions/33822075/cannot-identify-selected-page-in-telerik-grid-i-need-selected-page-to-be-underl

    Plz go through the link and and help me

     

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017