Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » Controls » Downloads
 
Add your own
alternative version

Tagged as

Go to top

Cascaded dropdown using jQuery

, 28 May 2009
Implementation of cascaded dropdowns using jQuery.
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
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

himanshu2561
Web Developer
India India
g

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 28 May 2009
Article Copyright 2009 by himanshu2561
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid