简体   繁体   English

如何将一个AspxListBox绑定到两个以上的属性

[英]How to bind an AspxListBox to more than two properties

Maybe the title isn't clear enough. 标题可能不够清楚。

I have a data set whose objects have a key, a text and description. 我有一个数据集,其对象具有键,文本和描述。 how do i bind this description property to the list box so that i can manipulate in client-side? 如何将这个description属性绑定到列表框,以便可以在客户端进行操作? I cannot show the description to the user and its not something i can derive from the key and text. 我无法向用户显示说明,并且我无法从键和文本中得到描述。

--EDIT-- apparently i cannot submit the question as-is, i need to show what i have done so far: -编辑-显然我不能按原样提交问题,我需要证明我到目前为止所做的一切:

//lbTemplates_OnCallback
            var elementIds = new[] { SmsElementKey };// ConfiguredElements.Split(',').Select(long.Parse).ToArray();
            var v = smsTemplateDao.ListByElementTypes(elementIds);
            lbTemplates.DataSource = v;
            lbTemplates.DataBind();
            lbTemplates.SelectedIndex = -1;

The markup: 标记:

<dx:ASPxListBox ID="lbTemplates" runat="server" ClientInstanceName="lbTemplates" EnableViewState="False" Height="210px" OnCallback="lbTemplates_OnCallback" Width="220px"  ValueField="ParkElementId" TextField="ElementPath">
<ClientSideEvents SelectedIndexChanged="UpdateButtons" Init="UpdateButtons" />
</dx:ASPxListBox>

您可以同时使用DataTextField和DataValueField。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM