有没有人知道如何创建类似于ASP.NET网站名人堂部分的寻呼机?
http://www.asp.net/community/recognition/hall-of-fame
是GridView吗?它是ListView吗? 如何创建一个与其中完全相同的寻呼机?
答案 0 :(得分:0)
要执行此类操作,您可能会尝试将数据绑定到asp:ListView
,然后在客户端应用datatables以进行“平滑”分页。
要做到这一点,你需要一个类为“datatable”的表,你还需要数据表的thead和tbody,以及用jQuery选择表的一些方法(如下所示,表中的id) LayoutTemplate是“tblStuff”,我确保没有runat =“server”)。另外,在设计视图中创建LayoutTemplate时要小心,因为Visual Studio通常会将一个表嵌套在另一个表中。
<LayoutTemplate>
<table id="tblStuff" class="datatable">
<thead><tr><th>...(Your <th> elements go here)...</tr></thead>
<tbody><tr ID="itemPlaceholder" runat="server"></tr></tbody>
</table>
</LayoutTemplate>
现在脚本:
$(document).ready(function() {
$('#tblStuff').dataTable({
// See the datatables documentation for all the great options possible
});
});
如果您的数据集足够小,您可以将所有内容填充到ListView中,将其全部发送到客户端并使用数据表进行寻呼。如果您的数据集太大,您可以configure datatables to use Ajax获取页面数据,并设置Web方法以一次提供一页数据。
至于实现这个名人堂页面的“精确”外观,我认为你可以用适当的CSS来管理它。