ObjectDataSource do not call SelectCountMethod
-
07-07-2021 - |
Question
I am using SelectCountMethod to count rows returned but it is not being called for new classes i added .
Below is my code for UI.
<asp:ObjectDataSource ID="ObjDS1" runat="server" EnablePaging="false" TypeName="SomeBusinesslogicclass"
SelectCountMethod="GetCallCount" SelectMethod="sp_gettotalcallsummary2_ivr" OnSelecting="objDS_Selecting1"
OnSelected="objDS_Selected1">
Business Logic
public int GetCallCount(string Provider , string FromCallDate , string ToCallDate)
{
CallSummaryRepository rep = new CallSummaryRepository();
return rep.GetCallCount(Provider,FromCallDate,ToCallDate);
}
Data Access Layer
public int GetCallCount(string Provider , string FromCallDate , string ToCallDate)
{
int count = 0;
using (IVREntities context = new IVREntities())
{
var query = (from ap in context.sp_gettotalcallsummary2(Provider, FromCallDate, ToCallDate)
select ap
);
count = query.Count();
}
return count;
}
I have put breakpoints and tried to debug the code but it never gets into the GetCallCount function. I know the question is already asked few times but those answers do not solve my problem
Solution
Got the problem . I had set the paging property to false .
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow