daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest May 26th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //get data w/ sort expression
  2.         DataTable dt = (DataTable)gridview1.DataSource;
  3.  
  4.         //bind sorted data to another control
  5.         chartcontrol.datasource = dt.DefaultView.ToTable();
  6.         chartcontrol.databind();
  7.  
  8.         //add sorted ids to session to get crazy with
  9.         if (dt != null)
  10.         {
  11.             StringBuilder sb = new StringBuilder();
  12.             for (int i = 0; i < dt.Rows.Count; i++)
  13.             {
  14.                 sb.Append(dt.DefaultView[i]["ID"].ToString() + ",");
  15.             }
  16.             if (sb.Length > 0)
  17.                 sb.Remove(sb.Length - 1, 1);
  18.  
  19.             Session["SortedIDs"] = sb.ToString();
  20.          }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top