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. GridView Paging Problem

GridView Paging Problem

Scheduled Pinned Locked Moved ASP.NET
businesshelpquestion
5 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.
  • F Offline
    F Offline
    Faisal S P
    wrote on last edited by
    #1

    hello friends, I am using a button to Generate a dataset and DataBind the dataset to a GridView.. But when paging is enabled to the GridView and when we click on page numbers i have to click the button again to display the data again... whether i have to write some Code in PageIndexCahnged or Changing??? My Button Click Event is Like This protected void cmdSearchAll_Click(object sender, EventArgs e) { gvCandidates.Visible = true; // ProcessSelectAllCandidates is a Process From Business Logic Layer Which Will Generate a DataSet When Invoked(in try block) Then the DataSet (ie.ResultSet) is assigned as DataSource to GridView ProcessSelectAllCandidates allcandidates = new ProcessSelectAllCandidates(); try { allcandidates.Invoke(); } catch { Response.Redirect("~/ErrorPage.htm"); } gvCandidates.DataSource = allcandidates.ResultSet; gvCandidates.DataBind(); } what will be the problem?? thanks in advance regards your friend

    faz

    F N 2 Replies Last reply
    0
    • F Faisal S P

      hello friends, I am using a button to Generate a dataset and DataBind the dataset to a GridView.. But when paging is enabled to the GridView and when we click on page numbers i have to click the button again to display the data again... whether i have to write some Code in PageIndexCahnged or Changing??? My Button Click Event is Like This protected void cmdSearchAll_Click(object sender, EventArgs e) { gvCandidates.Visible = true; // ProcessSelectAllCandidates is a Process From Business Logic Layer Which Will Generate a DataSet When Invoked(in try block) Then the DataSet (ie.ResultSet) is assigned as DataSource to GridView ProcessSelectAllCandidates allcandidates = new ProcessSelectAllCandidates(); try { allcandidates.Invoke(); } catch { Response.Redirect("~/ErrorPage.htm"); } gvCandidates.DataSource = allcandidates.ResultSet; gvCandidates.DataBind(); } what will be the problem?? thanks in advance regards your friend

      faz

      F Offline
      F Offline
      fukchai2000
      wrote on last edited by
      #2

      Hi Faz, For my case, i will write a code in PageChanging. protected void GridView1_PageChanging(object sender, GridViewPageEventArgs e) { GridView gv = (GridView)sender; gv.PageIndex = e.NewPageIndex; //Bind the data to the GridView again } I have no idea if this is the problem that you have. Regards, Henri

      F 1 Reply Last reply
      0
      • F fukchai2000

        Hi Faz, For my case, i will write a code in PageChanging. protected void GridView1_PageChanging(object sender, GridViewPageEventArgs e) { GridView gv = (GridView)sender; gv.PageIndex = e.NewPageIndex; //Bind the data to the GridView again } I have no idea if this is the problem that you have. Regards, Henri

        F Offline
        F Offline
        Faisal S P
        wrote on last edited by
        #3

        hi henri, i have tried the code u gave..But still it is not working When i Click the Button to Display the GridView result it is coming.But When i click a Different page(Pagining Enabled) in the gridview i hav to clik the button again to view results from that particular page.. Coded like this in GridViewPageIndexChanging GridView gv = (GridView)sender; gv.PageIndex = e.NewPageIndex; dvCandidate.Visible = false; gvCandidates.Visible = true; ProcessSelectAllCandidates allcandidates = new ProcessSelectAllCandidates(); try { allcandidates.Invoke(); } catch { Response.Redirect("~/ErrorPage.htm"); } gv.DataSource = allcandidates.ResultSet; gv.DataBind();

        faz

        1 Reply Last reply
        0
        • F Faisal S P

          hello friends, I am using a button to Generate a dataset and DataBind the dataset to a GridView.. But when paging is enabled to the GridView and when we click on page numbers i have to click the button again to display the data again... whether i have to write some Code in PageIndexCahnged or Changing??? My Button Click Event is Like This protected void cmdSearchAll_Click(object sender, EventArgs e) { gvCandidates.Visible = true; // ProcessSelectAllCandidates is a Process From Business Logic Layer Which Will Generate a DataSet When Invoked(in try block) Then the DataSet (ie.ResultSet) is assigned as DataSource to GridView ProcessSelectAllCandidates allcandidates = new ProcessSelectAllCandidates(); try { allcandidates.Invoke(); } catch { Response.Redirect("~/ErrorPage.htm"); } gvCandidates.DataSource = allcandidates.ResultSet; gvCandidates.DataBind(); } what will be the problem?? thanks in advance regards your friend

          faz

          N Offline
          N Offline
          Naik A2Ze
          wrote on last edited by
          #4

          protected void cmdSearchAll_Click(object sender, EventArgs e) { gv.PageIndex=e.NewPageIndex; gv.DataBind(); } apply this code...

          Naik M

          F 1 Reply Last reply
          0
          • N Naik A2Ze

            protected void cmdSearchAll_Click(object sender, EventArgs e) { gv.PageIndex=e.NewPageIndex; gv.DataBind(); } apply this code...

            Naik M

            F Offline
            F Offline
            Faisal S P
            wrote on last edited by
            #5

            Hi naik, How i will get e.NewPageIndex in buttonclick event??? i think u didnt got my problem..Actucally my problem is like. i am using a button to fill the GridView. when paging is enabled and Click the button it will show the result.. But when we change the gridview page(say page2), i have to click the Button again to view the second page... please give me a solution it is urgent regards

            faz

            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