开发者

In markup, how do I concatenate two values for display in a dropdownlist?

I have a dropdownlist that currently displays an item name. I need to concatenate the item name and description f开发者_运维百科or display in the list. How do I concatenate them in markup? The desired string is of the form "Name ( Description )" where Name and Description are the actual field names and "(" and ")" are actual characters to be inserted.

Here's the markup so far. It works. It's just missing the concatentation of fields. Thanks!

<td>
     <DLC:DropDownListMax ID="ddlItems" runat="server" CssClass="XXX" AutoPostBack="false"
                    DataSourceID="ABC" DataTextField="Name" DataValueField="ID" >
     </DLC:DropDownListMax>
</td>


You should make a separate property in your datasource that returns the concatenated string.


You will either have to manipulate the datasource and concatenate the values there, or add the items to the list manually.


You can use the databinder method... DataTextField='<%# DataBinder.Eval(Container.DataItem, "Name" & "Description") %>'

I don't think that is the exact syntax.. But I have concatinated them before using that method. It seems a lot easier than manipulating your SP or the database.

Chad

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜