- jquery.zip
- Jquery
- App_Code
- App_Data
- Bin
- AjaxControlToolkit.dll
- ar
- AjaxControlToolkit.resources.dll
- cs
- AjaxControlToolkit.resources.dll
- de
- AjaxControlToolkit.resources.dll
- es
- AjaxControlToolkit.resources.dll
- fr
- AjaxControlToolkit.resources.dll
- he
- AjaxControlToolkit.resources.dll
- hi
- AjaxControlToolkit.resources.dll
- it
- AjaxControlToolkit.resources.dll
- ja
- AjaxControlToolkit.resources.dll
- ko
- AjaxControlToolkit.resources.dll
- nl
- AjaxControlToolkit.resources.dll
- pt
- AjaxControlToolkit.resources.dll
- ru
- AjaxControlToolkit.resources.dll
- tr-TR
- AjaxControlToolkit.resources.dll
- zh-CHS
- AjaxControlToolkit.resources.dll
- zh-CHT
- AjaxControlToolkit.resources.dll
- Default.aspx
- Default.aspx.cs
- Default.js
- jquery.validate.js
- jquery-1.3.2.min.js
- web.config
|
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
/// <summary>
/// Summary description for HimJSON1
/// </summary>
public class HimJSON1
{
private static List<Dictionary<string, object>> RowsToDictionary(DataTable table)
{
List<Dictionary<string, object>> objs = new List<Dictionary<string, object>>();
foreach (DataRow dr in table.Rows)
{
Dictionary<string, object> drow = new Dictionary<string, object>();
for (int i = 0; i < table.Columns.Count; i++)
{
drow.Add(table.Columns[i].ColumnName, dr[i]);
}
objs.Add(drow);
}
return objs;
}
public static Dictionary<string, object> ToJson(DataTable table)
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add(table.TableName, RowsToDictionary(table));
return d;
}
public static Dictionary<string, object> ToJson(DataSet data)
{
Dictionary<string, object> d = new Dictionary<string, object>();
foreach (DataTable table in data.Tables)
{
d.Add(table.TableName, RowsToDictionary(table));
}
return d;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.