In custome paging Next ,Previous ,Fisrt, Last Paging button not working

7 posts, 0 answers
  1. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 06 Apr 2013 Link to this post

    When i click on fist second Page index it works good but when  i click on Next,Previous and last Fist Page Index Button it does not working.
     
    here is my aspx page
    <telerik:RadGrid ID="grdReferralSearch" runat="server" AllowFilteringByColumn="True"
                  AllowPaging="True" AllowCustomPaging="true" AutoGenerateColumns="False" GridLines="None"
                  OnItemDataBound="grdReferralSearch_OnItemDataBound" OnItemCreated="grdReferralSearch_ItemCreated"
                  Width="100%" Skin="Windows7" ShowGroupPanel="false" CellSpacing="0" PageSize="50"
                  OnPageIndexChanged="grdReferralSearch_PageIndexChanged" OnPageSizeChanged="grdReferralSearch_PageSizeChanged">
                  <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
                  <MasterTableView DataKeyNames="Id" AllowFilteringByColumn="True" ShowHeader="true"
                    AllowMultiColumnSorting="false" >
                    <ItemStyle BorderStyle="Solid" />
                    <SortExpressions>
                      <telerik:GridSortExpression FieldName="ReferralName" SortOrder="Ascending" />
                    </SortExpressions>
                    <HeaderStyle Font-Bold="true" />
                    <Columns>
                      <telerik:GridBoundColumn DataField="ReferralName" HeaderText="Referral Name" SortExpression="ReferralName"
                        FilterControlWidth="100" ItemStyle-Width="100" />
                      
                    </Columns>
                    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" Position="Top" HorizontalAlign="Right" />
                  </MasterTableView>
                  <FilterMenu EnableImageSprites="False">
                  </FilterMenu>
                </telerik:RadGrid>

    and here is my code
    protected void Page_Load(object sender, EventArgs e)
        {
          try
          {
           if (IsPostBack == false)
            {
              BindReferralLookUp();
            }
            if (Page.IsCallback == false)
            {
              BindReferralLookUp();
            }
          }
          catch (Exception ex)
          {
            ShowError(ex.Message);
          }
     
    protected void grdReferralSearch_PageIndexChanged(object sender, GridPageChangedEventArgs e)
        {
          try
          {
            grdReferralSearch.CurrentPageIndex = e.NewPageIndex;
            BindReferralLookUp();
          }
          catch (Exception ex)
          {
            ShowError(ex.Message);
          }
        }
     
     private void BindReferralLookUp()
        {
          try
          {
            grdReferralSearch.VirtualItemCount = 10000;
            grdReferralSearch.DataSource = GetDataSource();
            grdReferralSearch.DataBind();
          }
          catch (Exception ex)
          {
            throw ex;
          }
     
    private List<ReferralSearchLookUp> GetDataSource()
        {
          try
          {
            lblTotalFound.Text = string.Empty;
            string referralName = string.Empty;
     
            if (!string.IsNullOrEmpty(txtReferralName.Text.Trim()))
            {
              referralName = txtReferralName.Text.Trim();
            }
     
            int pageIndex = grdReferralSearch.CurrentPageIndex + 1;
            int pageSize = grdReferralSearch.PageSize;
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex = (pageIndex * pageSize);
     
            var data = ReferralsData.ReferralSearch(referralName, startIndex, endIndex);
     
            return data;
          }
          catch (Exception ex)
          {
            throw ex;
          }
        }

    Can anybody help me?

    Thanks,

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

    Posted 07 Apr 2013 Link to this post

    Hello,

    Please check below link.
    http://www.telerik.com/help/aspnet-ajax/grid-pageritem.html

    You can add and use any command buttons to control grid paging. When using command buttons to control paging, set the CommandName to "Page", and the CommandArgument to "Next", "Prev", or the number of a page (e.g. "5").

    Note : you have to access those button and you have to assign CommanName as "Page" and set based on current page index you have to set CommandArgument.

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 07 Apr 2013 Link to this post

    Hey Jayesh,

    I appreciate with your link but it would be nice if send me any sample code.

    Thanks,
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Apr 2013 Link to this post

    Hi,

    Please try removing AllowCustomPaging property. Also make sure that grid uses advanced data binding using its NeedDataSource event.

    Thanks,
    Shinu
  6. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 08 Apr 2013 Link to this post

    Hey Shinu,
    I do not want to use NeedDataSource event.

    i just want to use Custom paging only. and its working as per Jayesh Goyani told to set
    if (e.Item is GridPagerItem)
    {        
              e.Item.OwnerTableView.PagerStyle.FirstPageText = "First";
              e.Item.OwnerTableView.PagerStyle.PrevPageText = "Prev";
              e.Item.OwnerTableView.PagerStyle.NextPageText = "Next";
              e.Item.OwnerTableView.PagerStyle.LastPageText = "Last";
    }

    and its showing both custom button and by-defaults button as shown in image.
    can you help me to come-out this situation ?

    Thanks
  7. shruti
    shruti avatar
    2 posts
    Member since:
    Jun 2015

    Posted 20 Jun 2015 Link to this post

    I am using Pagination in radgrid. On first time page load the pager buttons are visible but when i click on next arrow button or a number index in the pager, the pager buttons are not visible even though grid is populating with correct data. What can be the reason. Any input will be appreciated.

    Thanks

  8. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Jun 2015 Link to this post

    Hello Shruti,

    Could you verify that you are not using DataBind() to bind the grid? Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
    Declarative DataSource
    Programmatic Data Binding


    If this is not the case, you can temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there is script error interfering.


    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017