zoukankan      html  css  js  c++  java
  • 使用按钮绑定数据

    public partial class Form_Jurisdiction : XtraForm
        {
            Command.BusinessCommand.ProjectExplorer.com_Project com = new Command.BusinessCommand.ProjectExplorer.com_Project();
            string p_id;
            public Form_Jurisdiction(string _p_id)
            {
                p_id = _p_id;
                InitializeComponent();
                this.Load += (s, e) =>
                {
                    Task.Factory.StartNew(() =>
                    {
                        this.BeginInvoke(new Action(() =>
                        {
                            SetTextAndClick();
                            BandData();
                        }));
                    });
                };
            }
            private void BandData() //无论是否有值,都绑定之前的窗口
            {
                List<Model.BusinessSelectModel.ProjectExplorer.Project_Jurisdiction> list = com.selectJuridictionById(p_id);
                this.ckb_staff.EditValue = string.Join(",", list.Where(w => w.j_type.Equals(false)).Select(w => w.j_id));
                this.ckb_group.EditValue = string.Join(",", list.Where(w => w.j_type.Equals(true)).Select(w => w.j_id));
                this.ckb_staff.RefreshEditValue();
                this.ckb_group.RefreshEditValue();
            }
            public void SetTextAndClick()//保存按钮绑定的信息
            {
                this.ckb_staff.Properties.DataSource = com.ReturnStaffList();
                this.ckb_staff.Properties.DisplayMember = "lookname";
                this.ckb_staff.Properties.ValueMember = "lookvalue";
                this.ckb_staff.Properties.NullText = "";
                this.ckb_group.Properties.DataSource = com.ReturnGroupList();
                this.ckb_group.Properties.DisplayMember = "lookname";
                this.ckb_group.Properties.ValueMember = "lookvalue";
                this.ckb_group.Properties.NullText = "";
                this.btn_save.Click += (s, e) =>
                {
                    string staffs = this.ckb_staff.EditValue.ToSaleString();
                    string groups = this.ckb_group.EditValue.ToSaleString();
                    if (com.SetAndAddJurisdiction(p_id, staffs, groups))
                    {
                        XtraMessageBox.Show("设置成功", "提示消息");
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("设置失败", "提示消息");
                    }
                };
            }
    
        }
  • 相关阅读:
    使用winScp、putty导出mysql
    npm安装依赖
    node_modules文件夹出现.staging文件夹是怎么回事?
    jhipster生成工程
    npm使用国内淘宝镜像
    JAVA实现指定日期加几天
    php 使用ldap_connect方法连接AD时失败原因分析
    oracle中数据发生变动一定要commit 一定要commit 一定要commit
    Math中的round
    java中的实例变量和类变量的区别与联系:
  • 原文地址:https://www.cnblogs.com/Tianxf815/p/8892258.html
Copyright © 2011-2022 走看看