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 9226917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:56:34+00:00 2026-06-18T04:56:34+00:00

When I was changing page number, I was getting error The GridView ‘GridView1’ fired

  • 0

When I was changing page number, I was getting error

"The GridView 'GridView1' fired event PageIndexChanging which wasn't handled."

But afterwards, I searched and try to put this code in PageIndexChanging even, still it isn’t working :

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.SelectedIndex = e.NewPageIndex;
    GridView1.DataSource = SqlDataSource1;
    GridView1.DataBind();
}

Originally, when user prompts to page, I am showing all data on gridview, then user can search data, and upon clicking Search button, below code is executing :

 protected void Button1_Click(object sender, EventArgs e)
{
    DateTime dt1 = DateTime.Now, dt2 = DateTime.Now;
    Connection.getCon();
    try
    {
         dt1 = Convert.ToDateTime(TextBox3.Text);
         dt2 = Convert.ToDateTime(TextBox4.Text).AddDays(1);
        lblError.Visible = false;
    }
    catch (Exception exc) {
        lblError.Visible = true;
    }


    string cmd = "select * from tblLogs where (users like '%"+TextBox1.Text.Trim()+"%') and (request like '%"+TextBox2.Text.Trim()+"%') and (requesttime>='"+dt1+"') and (requesttime<'"+dt2+"') ";
    SqlDataSource1.SelectCommand = cmd;
    DataView dv= (DataView) SqlDataSource1.Select(DataSourceSelectArguments.Empty);
    GridView1.DataSourceID = null;
    GridView1.DataSource= dv;
    GridView1.DataBind();
    //GridView1.AllowPaging = false;

}

Now, I am not getting any error, but still page is not changing and staying on 1.

Thanks.

  • 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-18T04:56:35+00:00Added an answer on June 18, 2026 at 4:56 am

    You are using the wrong property in your PageIndexChanging event, it should be PageIndex instead of SelectedIndex:

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataSource = SqlDataSource1;
        GridView1.DataBind();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When changing the selected item in a ListBox, I'm getting a weird error where
On each page load i am changing a image. I found this plugin which
I have changing number of divs (elements) and ordering them on page as follows:
I have a number of filters in the side menu of my page, which
Is it possible to scroll to the top of the page when changing the
I want to reload my page (PHP) on changing value from the dropdownmenu and
Changing a Linux C++ program which gives the user limited file access. Thus the
After changing the import as a from-import i'm running into this error: from datetime
i record number of queries of my website and in page the below script
I'm building a UserControl that will repeat on the page a variable number of

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.