The problem here seems to be with ListView. Since you have set EnablePaging="true"
for ObjectDataSource, So your ObjectDataSource
will always look for a Select
method having two parameters: MaximumRows
& startRowIndex
.
startRowIndex
is incremented automatically depending on your MaximumRows
setting.
In case of Grid view MaximumRows
is specified using the GridView property: PageSize
. In case you don't specify this, default value of 10
is used for MaximumRows
.
In case of your ListView
there is NO such setting as PageSize
, so NO option of any default value. If you check your Select
method when list view binding is to be done, you will see that the value of MaximumRows
equals -1
.
So, the correction you need to apply is using a DataPager in your .aspx file as below. Note that the PagedControlID
property is set to ID of your List view.
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="lvService"
PageSize="20">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
Again , the PageSize
property specifies the MaximumRows
parameter value.