如何在datalist中按名称获取最高记录..
<asp:DataList ID="dlOtherTrends" runat="server" OnItemDataBound="dlOtherTrends_OnItemDataBound">
<ItemTemplate>
<li><a href="PostDetail.aspx?CatID=<%# Eval("CATID") %>&# <%# Eval("NAME") %>"><img id="imgPost" runat="server" width="70"></a>
<span><a href="PostDetail.aspx?CatID=<%# Eval("CATID") %>&# <%# Eval("NAME") %>"><asp:Label ID="lblPostName" runat="server"></asp:Label></a></span></li>
</ItemTemplate>
</asp:DataList>
现在这是列表页面..
<asp:DataList ID="dlPost" runat="server" OnItemDataBound="dlPost_OnItemDataBound">
<ItemTemplate>
<article>
<h1><asp:Label ID="lblPostName" runat="server" Text="Label"></asp:Label></h1><a name="<%# Eval("NAME") %>"></a>
<span class="posted">Posted on <asp:Label ID="lblPostDate" runat="server" Text="Label"></asp:Label> by <a href="#">Editor</a></span>
<p><img id="imgPost" runat="server" width="540"></p>
<p><div id="DivDescr" runat="server"></div></p>
<p> </p>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like"<%="fb:like:layout"%>="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone"<%="g:plusone:size"%>="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4fc6ff7e30646c29"></script>
<!-- AddThis Button END -->
</article>
</ItemTemplate>
</asp:DataList>
通过点击imgPost和lblPostName,我需要在第二个中使用相同的记录....问题是所有记录都在同一页面中但我想先显示选定的一个
答案 0 :(得分:1)
select top name from urdataTable desc
如果你正在使用sql server
,这将会这样做