Selectcountmethod in objectdatasource not called

I came across a situation where selectcountmethodit is not called.

getdatamethodcalled every time, but the counting method is not. I also tried uninstalling selectcountmethodand installing enablepaging="false", and the data will not be displayed, even if the data set 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
source share
1 answer

Try using the sample code here:

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

Check your request first to make sure the data is returned. Also set the MaximumRowsParameterName and StartRowIndexParameterName parameters to the appropriate parameters in the selected query.

+1

Source: https://habr.com/ru/post/1733982/


All Articles