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
Create a new asp.net web site and add new page . Darg and drop gridview on page . and write this function on code behind of asp.net web page as shown below
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
}
{
GridView1.PageIndex = e.NewPageIndex;
BingGridViewData();//Call bind gridview function
}
Create a new asp.net web site and add new page . Darg and drop gridview on page . and write this function on code behind of asp.net 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;
_objda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
_objcon.Close();
}
{
_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;
_objda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
_objcon.Close();
}
Thanks for sharing
ReplyDelete