Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:06:07+00:00 2026-06-03T10:06:07+00:00

I have paging in my GridView, and it worked nicely before: it was filtering

  • 0

I have paging in my GridView, and it worked nicely before: it was filtering by a “user key” value in a TextBox. However, since I added filtering to my GridView, the paging has some problems. When the user tries to click page 2, it will show page 2 of the GridView before it was filtered.

Can someone help me? Below is my paging code-behind:

protected void gvPaging(object sender, GridViewPageEventArgs e)
{
    DefaultData();
    GridView1.PageIndex = e.NewPageIndex;
    GridView1.DataBind();
} 

filtering code:

protected void Button1_Command(object sender, EventArgs e)
{    
    string folderName = ConfigurationManager.AppSettings["folderPDF"].ToString();
    string path = Server.MapPath("./");
    string fpaths = path + folderName;
    string[] filePath = Directory.GetFiles(fpaths, "*.pdf");
    DataTable table = GetTable(filePath);

    //var dataTable = (DataTable)GridView1.DataSource;
    var dataView = table.DefaultView;
    dataView.RowFilter = "folderName LIKE '" + DocSearch.Text.Trim() + "%'";

    GridView1.DataSource = table;
    GridView1.DataBind();

    DocSearch.Text = "";
}

DefaultData()

public void DefaultData()
{
    string folderName = ConfigurationManager.AppSettings["folderPDF"].ToString();
    string path = Server.MapPath("./");
    string fullPath = path + folderName;
    string[] filePaths = Directory.GetFiles(fullPath, "*.pdf");
    DataTable table = GetTable(filePaths);

    GridView1.DataSource = table;
    GridView1.DataBind();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:06:10+00:00Added an answer on June 3, 2026 at 10:06 am

    You need to add the filterig option into the the grid view paging function or it will not work, since you need to tell it from what data source it should fetch the information

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview with paging enabled and a textbox where the user can
I have a user control that has a gridview in it with paging. The
I have a gridview within an updatepanel which allows paging and has a linkbutton
I have a GridView that has it's columns added dynamically in codebehind. I've added
I have created a gridview for populating data, and some user control (TextBox) to
I have an ASP .NET GridView with Paging. One column in it has a
I have GridView and this grid has setup paging, but this paging not show
I have an ASP.NET GridView with paging enabled. The list of page indexes are
I have a paging worked with NHibernate: public IEnumerable<Answer> GetAnswers(int page, int pageSize) {
I have a paging control on my site that has it's container element set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.