Beispiel #1
0
    /// <summary>
    /// 根据权限获取菜单
    /// </summary>
    /// <returns>菜单列表</returns>
    public String getMenu()
    {
        DataTable dt             = DataManager.GetDataTable("select * from menu_info where id<9 order by id asc");
        String    menuCollection = CommonTool.DataTableToJson(dt);//DataTable转Json

        return(menuCollection);
    }
Beispiel #2
0
    protected void test(object sender, EventArgs e)
    {
        //Response.ContentType = "application/json";
        //Hashtable hash = new Hashtable();
        //hash.Add("error", "");
        //hash.Add("key2", "val2");
        ////序列化
        //string o = new JavaScriptSerializer().Serialize(hash);//值:"{\"Name\":\"苹果\",\"Price\":5.5}"
        //Response.Write(o);
        DataTable dt             = DataManager.GetDataTable("select * from menu_info where id<9 order by id asc");
        String    menuCollection = CommonTool.DataTableToJson(dt);//DataTable转Json

        Context.Response.ContentType = "application/json";
        Context.Response.Write(menuCollection);
        Context.Response.End();
    }