Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Paging in DataGrid stopped working

Paging in DataGrid stopped working

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    veroBT
    wrote on last edited by
    #1

    :confused:I've created a pretty basic datagrid and had the paging working fine. Then when i created a different page (with a different datagrid) my paging stopped working for both. I used the same method name for both datagrids OnPageIndexChanged event. When i change them to different names, it still won't work. Anyone have any ideas how to fix? Here are the attributes of the Datagrid... PagerStyle-CssClass="smallblackbold" OnPageIndexChanged="dgr_searchResultsPageIndexChanged" PagerStyle-Mode=NumericPages PageSize=25 AllowPaging=True Thanks, BT.

    D 1 Reply Last reply
    0
    • V veroBT

      :confused:I've created a pretty basic datagrid and had the paging working fine. Then when i created a different page (with a different datagrid) my paging stopped working for both. I used the same method name for both datagrids OnPageIndexChanged event. When i change them to different names, it still won't work. Anyone have any ideas how to fix? Here are the attributes of the Datagrid... PagerStyle-CssClass="smallblackbold" OnPageIndexChanged="dgr_searchResultsPageIndexChanged" PagerStyle-Mode=NumericPages PageSize=25 AllowPaging=True Thanks, BT.

      D Offline
      D Offline
      Dr_X
      wrote on last edited by
      #2

      Just off the top of my head.... Look at the end of each procedure's dgr_searchResultsPageIndexChanged event to see if the Handles keyword is reflecting the new datagrid name. I've changed control names in the past and the Handles' portion of the sub statement didn't reflect the new control's name. Hopefully this is the problem as it is an easy fix. Let me know if it corrects the problem. Michael

      V 1 Reply Last reply
      0
      • D Dr_X

        Just off the top of my head.... Look at the end of each procedure's dgr_searchResultsPageIndexChanged event to see if the Handles keyword is reflecting the new datagrid name. I've changed control names in the past and the Handles' portion of the sub statement didn't reflect the new control's name. Hopefully this is the problem as it is an easy fix. Let me know if it corrects the problem. Michael

        V Offline
        V Offline
        veroBT
        wrote on last edited by
        #3

        The code behind is written in C# so the "Handles" keywords aren't used. Here is the code for the DataGrid: And here is the code behind: public void dgr_searchResultsPageIndexChanged(object sender, DataGridPageChangedEventArgs e) { setVariablesFromForm(); createProjectDataSet(); dgr_results.DataSource = dst_searchResults; dgr_results.CurrentPageIndex = e.NewPageIndex; dgr_results.DataBind(); } Thanks, BT

        M 1 Reply Last reply
        0
        • V veroBT

          The code behind is written in C# so the "Handles" keywords aren't used. Here is the code for the DataGrid: And here is the code behind: public void dgr_searchResultsPageIndexChanged(object sender, DataGridPageChangedEventArgs e) { setVariablesFromForm(); createProjectDataSet(); dgr_results.DataSource = dst_searchResults; dgr_results.CurrentPageIndex = e.NewPageIndex; dgr_results.DataBind(); } Thanks, BT

          M Offline
          M Offline
          Marcie Jones
          wrote on last edited by
          #4

          For C#, you need the following in your InitializeComponent: this.IDOFYOURDATAGRID1.PageIndexChanged += new EventHandler(dgr_searchResultsPageIndexChanged); this.IDOFYOURDATAGRID2.PageIndexChanged += new EventHandler(dgr_searchResultsPageIndexChanged); And if you're using codebehind, you don't need OnPageIndexChanged="dgr_searchResultsPageIndexChanged" in your declaration. Hope that helps! Datagrid Girl

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups