专注数字产品开发
将创新和需求转化为专业的数字化解决方案

帮助企业在不断变化的数字环境中脱颖而出
©2023 Copyright reserverd

威海佰年网络技术有限公司 首页知识库

  • 抢先式多线程网络蜘蛛

    发布:2023-02-24 威海网络公司
  • 框架 // Copyright(C) 2017 铭飞科技 // #region 版权信息 /* * 此文件自 Copyright(C) 2008 - 2017 铭飞科技 Classification:无 开源网站:http://www.http://www. coding */ #endregion using System; using System.Data; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; namespace Web.Templates.UI { ///

    /// 标签树控件 /// public class Tree : System.Web.UI.WebControls.TreeView { private string _styleName = ""; /// /// 样式 /// /// The name of the style. public string StyleName { get { return _styleName; } set { _styleName = value; } } private string _checkedValue = ""; /// /// 默认选中当前值 /// /// The checked value. public string CheckedValue { get { return _checkedValue; } set { _checkedValue = value; } } private string _checkBoxName = ""; /// /// 复选框名称 /// /// The check box name. public string CheckBoxName { get { return _checkBoxName; } set { _checkBoxName = value; } } private int _checkParentType = -1; /// /// /// /// The type of the check parent. public int CheckParentType { get { return _checkParentType; } set { _checkParentType = value; } } private int _checkChildType = -1; /// /// /// /// The type of the check child. public int CheckChildType { get { return _checkChildType; } set { _checkChildType = value; } } private string _showLevel = "999"; /// /// 显示层级 /// /// The show level. public string ShowLevel { get { return _showLevel; } set { _showLevel = value; } } private string _valueField = "id"; /// /// 编号字段名 /// /// The value field. public string ValueField { get { return _valueField; } set { _valueField = value; } } private string _textField = "title"; /// /// 显示字段名 /// /// The text field. public string TextField { get { return _textField; } set { _textField = value; } } private string _fatherField = "parentid"; /// /// 父编号字段名 /// /// The father field. public string FatherField { get { return _fatherField; } set { _fatherField = value; } } private TreeNodeBindEventHandler _onBind; /// /// 构建事件 /// /// The on bind event. public event TreeNodeBindEventHandler OnBind { add { _onBind += value; } remove { _onBind -= value; } } private DataTable _dataSource; /// /// 数据源 /// /// The data source. public DataTable DataSource { get { return _dataSource; } set { _dataSource = value; } } /// /// 绑定数据 /// public override void DataBind() { this.Nodes.Clear(); this.ShowCheckBox = this.CheckBoxName != "" && this.CheckBoxName != null; if (_dataSource != null) { TreeNode root_node = new TreeNode(); root_node.Value = "-1"; root_node.Text = "根目录"; Nodes.Add(root_node); List root_list = new List(); for (int i = 0; i < _dataSource.Rows.Count; i++) { TreeNode node = new TreeNode(); DataRow dr = _dataSource.Rows[i]; node.Value = dr[_valueField].ToString(); node.Text = dr[_textField].ToString(); node.SelectAction = TreeNodeSelectAction.None; //node.Depth =int.Parse(_showLevel); if (_onBind != null) { _onBind(node); } if (dr[_fatherField].ToString() == "-1" || dr[_fatherField].ToString() == "0") { Nodes.Add(node); if (node.Value == _checkedValue) { node.Checked = true; } int has = 0; for (int j = 0; j < root_list.Count; j++) { if (root_list[j] == int.Parse(node.Value)) { has = 1; } } if (has == 0) { root_list.Add(int.Parse(node.Value)); } } else { TreeNode father_node = GetNode(root_node, dr[_fatherField].ToString()); if (father_node != null) { father_node.ChildNodes.Add(node); if (node.Value == _checkedValue) { node.Checked = true; } } } } //绑定事件,自动勾选父级节点 if (this.CheckParentType == 0 || this.CheckChildType == 0) { string enterjvice = ""; if (this.CheckParentType == 0) { enterjvice += "FatherChecked"; } if (this.CheckChildType == 0) { enterjvice += "ChildChecked"; } if (enterjvice != "" && this.Nodes.Count > 0) { this.Attributes.Add("onclick", "JscAutoCheckedNode(this,'" + enterjvice + "');"); } } } base.DataBind(); } /// /// 构建HTML /// /// The object that receives the server control content. protected override void Render(HtmlTextWriter writer) { string[] style_list = new string[] { "admin_tree", "data_tree", "input_tree", "menu_tree", "popmenu_tree" }; switch (_styleName) { case "menu_tree": this.ShowCheckBox = false; this.CssClass += " menu"; break; case "popmenu_tree": this.

    Chatgpt




    手机扫码阅读

    更多资讯

    专业的技术驱动型网络技术公司,公司成立于2009年,12年专注数字产品开发,用创新迎合客户不断增长的需求,为客户提供专业的数字化解决方案, 为企业和品牌在不断变化的数字化环境中脱颖而出。

    威海网站建设, 威海微信公众号开发, 威海企业邮箱, 威海行业网站, 威海系统开发, 威海软件开发, 威海APP开发, 威海域名注册, 威海商标查询, 威海商标注册, 威海商标设计, 威海知识产权代理, 威海房产销控系统, 威海缺陷跟踪系统, 威海企业云/私有云解决方案, 威海企业邮局

    合作企业 COOPERATOR

    沐兮知识产权代理有限公司

    商标查询, 商标注册, 软件著作权申请, 商标续展, 知识产权代理
    撤三业务, 商标类法律文书咨询业务, 商标业务咨询

    阿里云

    域名注册, 企业邮局/邮箱注册, ECS, 香港主机, 海外主机

    联系我们 CONTACT

    山东 . 威海 青岛中路87 阿里巴巴四十大道 A1512号
    SERVICE@BRILINE.NET
    设计、建站、邮箱、主机、改版、维护
    开发、数据维护、私有云、服务器
    商标注册、变更、复审、答辩、续展、备案
      周一 - 周五 13385420936
    0.045480s