【问题标题】:How to add control in the special column/row of DataList?如何在DataList的特殊列/行中添加控件?
【发布时间】:2013-04-10 13:36:29
【问题描述】:

我有一个包含 3 列和 3 行的数据列表,将其绑定到数据源。

 <asp:DataList ID="DataList1"  RepeatDirection="Horizontal" runat="server" RepeatColumns="3">
   <ItemTemplate>
     <a href="#" class="tile group0 " style="margin-left: 20px; margin-right: 20px; width: 145px; height: 126px; background: none repeat scroll 0% 0%  rgb(102, 128, 0); display: inline;">
       <h5 class="white"><%# Eval("Name") %></h5>
     </a>
   </ItemTemplate>
  </asp:DataList>

我在数据源中有 8 条记录。

DataTable dt = clsCategoryFactory.GetAllDT();
DataList1.DataSource=dt;
DataList1.DataBind();

我想在第 3 行第 3 列上为此添加一个按钮。

可以在datalist的特殊列/行中添加控件吗?

【问题讨论】:

    标签: asp.net datalist


    【解决方案1】:

    你为什么不把你的按钮放在页脚模板中。

    <FooterTemplate>
        <asp:Button ID="btnNext" runat="server" Text="CheckOut" 
             onclick="btnNext_Click" />
    </FooterTemplate>
    

    【讨论】:

    • 因为我想将按钮添加到数据列表的第 3 列和第 3 行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多