【问题标题】:how to get value of listbox item by item template如何按项目模板获取列表框项目的值
【发布时间】:2014-03-09 08:02:11
【问题描述】:

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

<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 中获取文本。

【问题讨论】:

    标签: c# asp.net listbox telerik itemtemplate


    【解决方案1】:

    &lt;ItemTemplate&gt; 块内试试这个:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      相关资源
      最近更新 更多