簡體   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