【发布时间】:2015-05-26 19:04:24
【问题描述】:
<asp:SqlDataSource ID="SqlKitapDataSoruce" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseProjeConnectionString %>"
SelectCommand="SELECT * FROM [Kitap] ORDER BY [satisSayisi] DESC" >
</asp:SqlDataSource>
<% for(int i = 0; i < 5; i++) %>
<% { %>
<div class="indexKitap">
<asp:ImageButton ID="<% %>" runat="server" ImageUrl="<% %>" />
<asp:Label ID="LblKitapAd" runat="server" Text="<% %>"></asp:Label>
</div>
我有这段代码,我想使用名为 foto_path 的列作为 ImageUrl 和 kitap_ad 作为标签的文本,但我不知道如何在 html 标记中使用数据源的参数。我尝试像<%#foto_path%> 一样使用,但它给出了错误。如何在 html 标签中使用数据源的参数?
【问题讨论】:
-
如果你不知道
i(我们数据源中的记录数)的值,你会怎么做? for 循环的内容如何知道它与 SqlKitapDataSoruce 数据源相关联?查理的回答是做你想做的事的一种方式。 asp.net 是您可以查看以了解更多信息或开始的起点之一。
标签: c# html asp.net datasource