public void BRANCHES(String desc) { DataTableToJSON(ds.Tables[0]); return; } public void DataTableToJSON(DataTable table) { List<dictionary><string,>> list = new List<dictionary><string,>>(); foreach (DataRow row in table.Rows) { Dictionary<string,> dict = new Dictionary<string,>(); foreach (DataColumn col in table.Columns) { dict[col.ColumnName] = row[col]; } list.Add(dict); } System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); String abcd = serializer.Serialize(list).Replace("[", "").Replace("]", ""); HttpContext.Current.Response.BinaryWrite(encoding.GetBytes(abcd)); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)