That looks like a great property but it still only shows one page.
![PageCount Bug.bmp]()
If I change the Records Per Page to 30, I see all records.
I think I did what you said below. Here is my SP:
CREATE PROCEDURE [dbo].[_Elements_GetByEquipmentTypeIDCategoryID]
(
@EquipmentTypeID int,
@CategoryID int,
@TotalRecords int= null OUTPUT
)
AS
SETANSI_NULLS OFF
…
SET@TotalRecords = @@ROWCOUNT;
SETANSI_NULLS ON
Here is my new code:
<data:EntityGridView id="GridView1" runat="server" DataSourceID="edsElements"
AllowPaging="True" AllowSorting="True" PageSelectorPageSizeInterval="10"
ExcelExportFileName="Export_Elements.xls" DefaultSortDirection="Ascending"
DefaultSortColumnName="" AllowMultiColumnSorting="false" DataKeyNames="ElementID"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:CommandField ShowSelectButton="True" ShowEditButton="True"></asp:CommandField>
<asp:BoundField DataField="ElementName" SortExpression="ElementName" HeaderText="Element Name"></asp:BoundField>
…
<data:ElementsDataSource id="edsElements" runat="server" SelectMethod="GetByEquipmentTypeIDCategoryID"
EnableDeepLoad="True" EnableSorting="True" EnablePaging="True"
CustomMethodRecordCountParamName="TotalRecords">
<DeepLoadProperties Method="IncludeChildren" Recursive="False">
<Types>
<data:ElementsProperty Name="Lists" />
<data:ElementsProperty Name="ControlTypes" />
</Types>
</DeepLoadProperties>
<Parameters>
<asp:ControlParameter ControlID="EquipmentTypesDropDownList" Name="EquipmentTypeID"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="CategoriesDropDownList" Name="CategoryID"PropertyName="SelectedValue"
Type="Int32" />
<asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
Type="Int32" />
<asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
Type="Int32" />
<asp:Parameter Name="TotalRecords" Type="Int32" Direction="InputOutput" />
</Parameters>
</data:ElementsDataSource>
From: mike123[mailto:bounce-mike123@codesmithsupport.com]
Sent: Tuesday, July 03, 2007 9:46 AM
To: dotnetbob@gmail.com
Subject: Re: [.netTiers Bug Reports] Wrong PageCount displayed inEntityGridView with Custom SelectMethod
Custom stored procs are handled a little bit different. You'd have to exposeoutput @totalrecords parameter:
CREATE PROCEDURE [dbo].[_Elements_GetByEquipmentTypeIDCategoryID]
(
@EquipmentTypeID int,
@CategoryID int
@totalrecords int = null OUTPUT
)
Then use CustomMethodRecordCountParamNameto make ObjectDataSource aware of that
data:ElementsDataSourceID="edsElements" runat="server"SelectMethod="GetByEquipmentTypeIDCategoryID"
EnablePaging="True"EnableSorting="True" EnableDeepLoad="True" CustomMethodRecordCountParamName="totalrecords">
<DeepLoadProperties Method="IncludeChildren"Recursive="False">
<Types>
<data:ElementsProperty Name="Lists" />
</Types>
</DeepLoadProperties>
<Parameters>
<asp:ControlParameterControlID="EquipmentTypesDropDownList"Name="EquipmentTypeID"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="CategoriesDropDownList"Name="CategoryID" PropertyName="SelectedValue"
Type="Int32" />
<asp:ControlParameter Name="PageIndex"ControlID="GridView1" PropertyName="PageIndex"
Type="Int32" />
<asp:ControlParameter Name="PageSize"ControlID="GridView1" PropertyName="PageSize"
Type="Int32" />
<asp:Parameter Name="totalrecords"Type="Int32" Direction="InputOutput" />
</Parameters>
</data:ElementsDataSource>
See it that helps