Advertisement
Guest User

Untitled

a guest
May 11th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. protected void grdProtocolli_Sorting(object sender, GridViewSortEventArgs e)
  2.         {
  3.             if (ViewState["SortExpression"] == null) //Se non c'è nessun ordinamento non c'è nulla
  4.             {
  5.                 ViewState["SortExpression"] = e.SortExpression; //Inserisco l'ordinamento
  6.                 ViewState["sortDirect"] = "TRUE"; //e la direzione è ASC
  7.             }
  8.             else
  9.             {
  10.                 if (Convert.ToString(ViewState["SortExpression"]) == e.SortExpression &&
  11.                     Convert.ToString(ViewState["sortDirect"]) == "TRUE") //Se ha ripremuto
  12.                 {
  13.                     ViewState["sortDirect"] = "FALSE"; //e la direzione è ASC
  14.                 }
  15.                 else if (Convert.ToString(ViewState["SortExpression"]) == e.SortExpression &&
  16.                         Convert.ToString(ViewState["sortDirect"]) == "FALSE")
  17.                 {
  18.                     ViewState["sortDirect"] = "TRUE"; //e la direzione è ASC
  19.                 }
  20.                 else
  21.                 {
  22.                     ViewState["SortExpression"] = e.SortExpression; //Nuovo ordinamento
  23.                     ViewState["sortDirect"] = "TRUE"; //direzione è ASC
  24.                 }
  25.             }
  26.  
  27.             //Ribindo la griglia
  28.             bindaGriglia(ViewState["Next"] as string);
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement