blogspot visit counter

Friday, 9 August 2013

GridView Paging Not Displaying Data After Switching Page

GridView Paging Not Displaying Data After Switching Page
Categories : - The GridView 'GridView1' fired event PageIndexChanging which wasn't handled

Introduction : - 

In this article i am explaining how i can show GridView Paging Not Displaying Data After Switching Page. In my previous article i have explained Java script for gridview in edit mode , Gridview rowcommand object reference not set to an instance of object

Description : -

I am having a bit of trouble with Paging within a GridView grid I have set up. I have added the paging but whenever I click on the next page or the last page buttons, the page refreshes and displays blank
So Bind the  Gridview as show below

  protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        GridView1.PageIndex = e.NewPageIndex;
        BingGridViewData();//Call bind gridview function

Create a new web site and add new page . Darg and drop gridview on page . and write this function on code behind of web page  as shown  below

protected void BingGridViewData()
        _objcon = DonetionConnectionDB.GetConnection();
        DataTable dt = new DataTable();
        string query = "SELECT * FROM causes_tab order by ID DESC";
        MySqlDataAdapter _objda = new MySqlDataAdapter(query, _objcon);
        _objda.SelectCommand.CommandType = CommandType.Text;
        GridView1.DataSource = dt;

1 comment:

Related Posts Plugin for WordPress, Blogger...