easyUI comboTree的实现

本文档介绍了如何使用Visual Studio 2010和SQL Server数据库创建一个easyUI comboTree。通过创建表格、Web空应用、添加相关类和一般处理程序,最终实现comboTree效果,并提供了获取JSON数据的调试过程。
摘要由CSDN通过智能技术生成

easyUI comboTree的实现

本示例用使用visual studio2010开发工具和sql Server数据库制作简单组合树comboTree,大神请绕道,实现的效果图如下:
这里写图片描述

知识点:easyUI comboTree、一般处理程序、json

制作过程
1.创建一张表,如下图
表设计
表内容

2.创建一个web 空应用程序,下图为已创建好的应用程序
这里写图片描述

2.1 添加一个类Unit.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace asp.net_下拉树实现
{
    public class Unit
    {
         public decimal id { get; set; }
         public decimal parent_id { get; set; }
         public string text { get; set; }
         public string state { get; set; }
         public List<Unit> children { get; set; }
         public Unit()
         {
             this.children = new List<Unit>();
             this.state = "open";
         }
    }
}

2.2 添加一个类ExeceteOralceSqlHelper.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace asp.net_下拉树实现
{
    public  class ExeceteOralceSqlHelper
    {


        //从config中获取链接字符串
        public static readonly string connstr = ConfigurationManager.ConnectionStrings["sqlconn"].ToString();

        //获得connection对象
        public static SqlConnection GetConn()
        {
            SqlConnection conn = new SqlConnection(connstr);
            conn.Open();
            return conn;
        }
 //获得DataTable
        public  DataTable GetDataTable(string sqlstr)
        {
            SqlConnection conn = GetConn();
            SqlCommand cmd = new SqlCommand(sqlstr, conn);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataTable tb = 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值