protected void gv_Sorting(object sender, GridViewSortEventArgse)
{
DataSet ds = newDataSet();
ds = bal.getdata();
ds.Tables[0].DefaultView.Sort = e.SortExpression +
" " + GetSortDirection(e.SortExpression);
gv.DataSource = ds.Tables[0].DefaultView;
gv.DataBind();
}
privatestring GetSortDirection(string column)
{
string sortDirection = "ASC";
ViewState["SortExpression"] = column;
ViewState["SortDirection"] = sortDirection;string sortExpression = ViewState["SortExpression"] asstring;if (sortExpression != null)
{
string lastDirection = ViewState["SortDirection"] asstring;if ((lastDirection != null) && (lastDirection == "ASC"))
{
sortDirection ="DESC";
}
}
return sortDirection;
}
protectedvoid gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
getdata();
}
{
DataSet ds = newDataSet();
ds = bal.getdata();
ds.Tables[0].DefaultView.Sort = e.SortExpression +
" " + GetSortDirection(e.SortExpression);
gv.DataSource = ds.Tables[0].DefaultView;
gv.DataBind();
}
privatestring GetSortDirection(string column)
{
string sortDirection = "ASC";
ViewState["SortExpression"] = column;
ViewState["SortDirection"] = sortDirection;string sortExpression = ViewState["SortExpression"] asstring;if (sortExpression != null)
{
string lastDirection = ViewState["SortDirection"] asstring;if ((lastDirection != null) && (lastDirection == "ASC"))
{
sortDirection ="DESC";
}
}
return sortDirection;
}
protectedvoid gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
getdata();
}
No comments:
Post a Comment