找回密码
 立即注册

QQ登录

只需一步,快速开始

qqlww

注册会员

13

主题

57

帖子

144

积分

注册会员

积分
144

活字格认证

QQ
qqlww
注册会员   /  发表于:2015-2-26 10:07  /   查看:11122  /  回复:10
C1FlexGrid 绑定的是DataTable, C1FlexGrid 中列绑定ComBox,而ComBox绑定的也是DataTable(  DisplayMember和ValueMember不容),改变了ComBox的值,希望DataTable的值是ValueMember而不是DisplayMember,这个该如何解决

10 个回复

正序浏览
Alice
社区贡献组   /  发表于:2015-2-27 11:53:00
11#
回复 8楼qqlww的帖子

界面导航与布局控件有Layout, Menu and toolbars, TileControl, Themes.
具体产品官网:
http://www.gcpowertools.com.cn/p ... inform_controls.htm

另外,你说的是.net下的UserControl类么?它提供一个可用来创建其他控件的空控件。C1的控件都可以继承。

评分

参与人数 1满意度 +5 收起 理由
qqlww + 5 可能是我表述的不太清楚。我的意思C1是否有一套和微软对应的全部控件

查看全部评分

请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-2-27 11:40:00
10#
回复 7楼qqlww的帖子

上面已经解释过,ComboBox的Editor的展示就是这样的策略。

如果你需要C1FlexGrid的列支持DisplayValue和Value,展示的是DisplayValue,存入的值是Value,可以使用C1FlexGrid的DataMap功能。

你的代码使用DataMap后如下所示:
  1.             DataTable dtBind = new DataTable("dtBind");
  2.             dtBind.Columns.Add(new DataColumn("display",typeof(string)));
  3.             dtBind.Columns.Add(new DataColumn("value", typeof(int)));
  4.             DataRow dr;
  5.             for (int i = 0; i < 3; i++)
  6.             {
  7.                 dr = dtBind.NewRow();
  8.                 dr["display"] = "d"+(i+1).ToString();
  9.                 dr["value"] = i + 1;
  10.                 dtBind.Rows.Add(dr);
  11.             }

  12.             dtGrid = new DataTable("dtGrid");
  13.             dtGrid.Columns.Add(new DataColumn("RType",typeof(int)));
  14.             DataRow drGrid;
  15.             for (int i = 0; i < 3; i++)
  16.             {
  17.                 drGrid = dtGrid.NewRow();
  18.                 drGrid["RType"] = i + 1;
  19.                 dtGrid.Rows.Add(drGrid);
  20.             }      

  21.             var mapCat = new Dictionary<int, string>();
  22.             foreach (DataRow row in dtBind.Rows)
  23.             {
  24.                 var key = (int)row["value"];
  25.                 var val = (string)row["display"];
  26.                 mapCat[key] = val;
  27.             }
  28.             this.c1FlexGrid1.DataSource = dtGrid;

  29.             // add data maps
  30.             this.c1FlexGrid1.Cols["RType"].DataMap = mapCat;
复制代码


这样子,就会将value的值存入dtGrid,但展示的是display的值。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-2-27 11:13:00
9#
回复 6楼qqlww的帖子

请问ImageComBox具体是什么样子?能否给出图解释下。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
qqlww
注册会员   /  发表于:2015-2-27 10:13:00
8#
C1和微软对应的Panel和UserControl,GroupBox都是哪些呀
回复 使用道具 举报
qqlww
注册会员   /  发表于:2015-2-27 08:42:00
7#
值和显示应该是分开处理吧。C1的列表有没有相关的处理。
回复 使用道具 举报
qqlww
注册会员   /  发表于:2015-2-27 08:28:00
6#
有没有像DEV那种的ImageComBox的机制的那种的呢?
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-2-26 18:21:00
5#
回复 4楼qqlww的帖子

根据你的描述,你设置了一个ComboBox给C1FlexGrid。并且进行了数据绑定。
这个时候C1FlexGrid的值就是ComboBox的DisplyMember的值。这是策略。

相关的示例如下:



你可以获取C1FlexGrid的ComboBox列的值,检验。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
qqlww
注册会员   /  发表于:2015-2-26 15:38:00
地板
您看下能明白不,不行我上附件
回复 使用道具 举报
qqlww
注册会员   /  发表于:2015-2-26 15:38:00
板凳
不好意思我描述的不清楚,    DataTable dtBind = new DataTable(&quot;dtBind&quot;);
            dtBind.Columns.Add(new DataColumn(&quot;display&quot;));
            dtBind.Columns.Add(new DataColumn(&quot;value&quot;));
            DataRow dr = dtBind.NewRow();
            dr[&quot;display&quot;] = &quot;d1&quot;;
            dr[&quot;value&quot;] = &quot;1&quot;;
            dtBind.Rows.Add(dr);

            dr = dtBind.NewRow();
            dr[&quot;display&quot;] = &quot;d2&quot;;
            dr[&quot;value&quot;] = &quot;2&quot;;
            dtBind.Rows.Add(dr);

            cmb.DataSource = dtBind;
            cmb.DisplayMember = &quot;display&quot;;
            cmb.ValueMember = &quot;value&quot;;
                dtGrid = new DataTable(&quot;dtGrid&quot;);
            dtGrid.Columns.Add(new DataColumn(&quot;RType&quot;));
            this.Grid1.DataSource = dtGrid;

            DataRow drGrid = dtGrid.Rows.Add();
            drGrid[&quot;RType&quot;] = &quot;1&quot;;

            drGrid = dtGrid.Rows.Add();
            drGrid[&quot;RType&quot;] = &quot;2&quot;;

            drGrid = dtGrid.Rows.Add();
            this.Grid1.Cols[&quot;RType&quot;].Editor = cmb;
就是这个意思
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部