binay00713
Broken In
How to handle the pageindexChanged in gridview in asp.net
in the following code?
protected void Page_Load(object sender, EventArgs e)
{
ob.conn();
gridview();
}
public void gridview()
{
ob.grdv("select * from user_album where user_id='" + Session["user_id"].ToString() + "'", GridView1);
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
gridview();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
gridview();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
if (GridView1.EditIndex!=-1)
{
// Use the Cancel property to cancel the paging operation.
e.Cancel = true;
// Display an error message.
int newPageNumber = e.NewPageIndex + 1;
Response.Write("<script>alert('Please update the record before moving to page')</script>");
}
else
{
// Clear the error message.
}
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
what to write here show that is goes to the page number clicked...
}
in the following code?
protected void Page_Load(object sender, EventArgs e)
{
ob.conn();
gridview();
}
public void gridview()
{
ob.grdv("select * from user_album where user_id='" + Session["user_id"].ToString() + "'", GridView1);
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
gridview();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
gridview();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
if (GridView1.EditIndex!=-1)
{
// Use the Cancel property to cancel the paging operation.
e.Cancel = true;
// Display an error message.
int newPageNumber = e.NewPageIndex + 1;
Response.Write("<script>alert('Please update the record before moving to page')</script>");
}
else
{
// Clear the error message.
}
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
what to write here show that is goes to the page number clicked...
}