Hello all,
I am using c#.net
I have a Grideview on my screen and need it to allow paging.
Source Code
<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>
Code-Behind
ObjectDataSource1.SelectParameters["maximumRows"].DefaultValue = "10";
ObjectDataSource1.SelectParameters["startRowIndex"].DefaultValue = "0";
LINQ query
public IQueryable<tblAppointment> GetBookingId(int maximumRows, int startRowIndex)
{
var result = (from a in dc.tblAppointments
select a).Skip(startRowIndex).Take(maximumRows);
}
However I recieve this error: The data source does not support server-side data paging.
What am I doing wrong?
Thanks in advanced for any help
Clare