首页 新闻 会员 周边

CRM 2011 获取实体属性类型为OptionSetValue的处理方式

0
悬赏园豆:50 [已关闭问题] 关闭于 2012-07-13 11:27

//获取实体,这个可以获取到数据

Entity entity = method.Retrieve("crm_channel", new Guid(guid), columnset);

entity.Attributes["crm_name"]

获取实体中属性的值,有的是Microsoft.Xrm.Sdk.EntityReference类型的,获取到值,有些是Microsoft.Xrm.Sdk.OptionSetValue类型的,我想问下Microsoft.Xrm.Sdk.OptionSetValue是什么,

OptionSetValue channel_type = entity.Attributes["crm_channel_type"] as OptionSetValue;
this.txt_crm_channel_type.Text = (channel_type == null ? 0 : channel_type.Value).ToString();这样获取的值,貌似是个ID,不是我要的值,想问一下怎么操作,获取处理OptionSetValue类型的值,为什么是这种类型,而不是EntityReference

刘满意的主页 刘满意 | 初学一级 | 园豆:22
提问于:2012-04-09 13:36
< >
分享
所有回答(1)
0

Microsoft.Xrm.Sdk.OptionSetValue类型对应的是Crm中选项集类型。网页中的选项属性分为:Value,Label等等。这里用OptionSetValue取得的是Value值,类似于WebForm中的SelectItem.Value;如果要取得Label值,我建议你参考下面的文章:http://www.cnblogs.com/jfzhu/archive/2012/12/11/2813712.html

Eric_Xu | 园豆:202 (菜鸟二级) | 2016-01-10 18:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册