我的屏幕上有一个GridView,需要它来允许分页。
标记:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="appID" HeaderText="appID" SortExpression="appID" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetBookingId"
TypeName="AppointmentRepository">
<SelectParameters>
<asp:Parameter Name="maximumRows" Type="Int32" />
<asp:Parameter Name="startRowIndex" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>代码隐藏:
ObjectDataSource1.SelectParameters["maximumRows"].DefaultValue = "10";
ObjectDataSource1.SelectParameters["startRowIndex"].DefaultValue = "0";LINQ查询:
public IQueryable<tblAppointment> GetBookingId(int maximumRows, int startRowIndex)
{
var result = (FROM a IN dc.tblAppointments
SELECT a).Skip(startRowIndex).Take(maximumRows);
}然而,我收到了这个错误:
数据源不支持服务器端数据分页。
我做错了什么?
https://stackoverflow.com/questions/1661292
复制相似问题