[英]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.