1
votes

I am facing a situation where the selectcountmethod isn't called.

The getdatamethod is called every time, but the count method is not. I also tried to remove the selectcountmethod and set enablepaging="false" and no data is displayed either, even if the dataset is not empty.

<asp:GridView ID="gvGradeDocent" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        DataSourceID="odsGradeDocent" DataKeyNames="Id" PagerStyle-HorizontalAlign="Right"
        PagerSettings-Position="Top" CssClass="table">            
        <Columns>
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" Visible="false" />                
            <asp:BoundField DataField="DecisionNo" HeaderText="DecisionNo" SortExpression="DecisionNo" />
            <asp:BoundField DataField="DecisionDate" HeaderText="DecisionDate" SortExpression="DecisionDate"
                DataFormatString="{0:dd/MM/yyyy}" />                
            <asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status" />
            <asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/Images/edit.png" />
            <asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Images/delete.png" />
        </Columns>
    </asp:GridView>
</div>
<asp:ObjectDataSource ID="odsGradeDocent" runat="server" SelectMethod="GetDocentGrades"
    TypeName="mash.BusinessLogic.DocentGrade" EnablePaging="True" DeleteMethod="Delete"
    SelectCountMethod="GetCountDocentGrades"></asp:ObjectDataSource>
1
Check your query first, in SQL Server? - IrishChieftain

1 Answers

1
votes

Try working with the code sample here:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.enablepaging.aspx

Check your query first to ensure that data is coming back. Also set the MaximumRowsParameterName and StartRowIndexParameterName parameters to the corresponding params in your select query.