繁体   English   中英

如何通过项模板获取列表框项的值

[英]how to get value of listbox item by item template

我有一个列表框。 我正在使用项目模板。 像那样

<telerik:RadListBox ID="lbOutputColumns" CssClass="RadListBox2" runat="server"
    SelectionMode="Multiple" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"
    Skin="" Width="300px">
    <ItemTemplate>
        <div class="variables-list" style="width: 300px !important">
            <span><%# Container.DataItem %></span>
        </div>
    </ItemTemplate>
    <Items>
        <telerik:RadListBoxItem Text="USA"></telerik:RadListBoxItem>
        <telerik:RadListBoxItem Text="Turkey"></telerik:RadListBoxItem>
        <telerik:RadListBoxItem Text="Greece"></telerik:RadListBoxItem>
    </Items>
</telerik:RadListBox>

当我用

<%# Container.DataItem %>

列表框不显示项目文本。 如何使用项目模板在radlistboxitem中获取文本。

<ItemTemplate>块中尝试以下操作:

<%# DataBinder.Eval(Container, "Text") %>

暂无
暂无

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

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