protected void gv_Sorting(object sender, GridViewSortEventArgs e)
{
string sortingDirection = string.Empty;
DataTable dtReg = (DataTable)ViewState["gv"];
if (direction == SortDirection.Ascending)
{
direction = SortDirection.Descending;
sortingDirection = "Desc";
}
else
{
direction = SortDirection.Ascending;
sortingDirection = "Asc";
}
DataView sortedView = new DataView(dtReg);
sortedView.Sort = e.SortExpression + " " + sortingDirection;
Session["objects"] = sortedView;
gv.DataSource = sortedView;
gv.DataBind();
}
public SortDirection direction
{
get
{
if (ViewState["directionState"] == null)
{
ViewState["directionState"] = SortDirection.Descending;
}
return (SortDirection)ViewState["directionState"];
}
set
{ ViewState["directionState"] = value; }
}
protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
gv.DataSource = Session["objects"];
gv.DataBind();
}
{
string sortingDirection = string.Empty;
DataTable dtReg = (DataTable)ViewState["gv"];
if (direction == SortDirection.Ascending)
{
direction = SortDirection.Descending;
sortingDirection = "Desc";
}
else
{
direction = SortDirection.Ascending;
sortingDirection = "Asc";
}
DataView sortedView = new DataView(dtReg);
sortedView.Sort = e.SortExpression + " " + sortingDirection;
Session["objects"] = sortedView;
gv.DataSource = sortedView;
gv.DataBind();
}
public SortDirection direction
{
get
{
if (ViewState["directionState"] == null)
{
ViewState["directionState"] = SortDirection.Descending;
}
return (SortDirection)ViewState["directionState"];
}
set
{ ViewState["directionState"] = value; }
}
protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gv.PageIndex = e.NewPageIndex;
gv.DataSource = Session["objects"];
gv.DataBind();
}
No comments:
Post a Comment