C# ObjectDataSource分页和额外参数
我使用ObjectDataSource进行排序/分页/筛选,如下所示:C# ObjectDataSource分页和额外参数,c#,asp.net,paging,objectdatasource,custompaging,C#,Asp.net,Paging,Objectdatasource,Custompaging,我使用ObjectDataSource进行排序/分页/筛选,如下所示: <asp:ObjectDataSource ID="odsCompaniesIndex" runat="server" EnablePaging="true" SelectMethod="GetCompaniesSubset" StartRowIndexParameterName="sta
<asp:ObjectDataSource
ID="odsCompaniesIndex" runat="server" EnablePaging="true"
SelectMethod="GetCompaniesSubset"
StartRowIndexParameterName="startRowIndex"
MaximumRowsParameterName="maximumRows"
SelectCountMethod="GetCompaniesCount"
SortParameterName="sortExpression"
TypeName="Company">
<SelectParameters>
<asp:ControlParameter ControlID="ddlStatus"
ConvertEmptyStringToNull="true"
DbType="Boolean" PropertyName="SelectedValue" Name="status" />
</SelectParameters>
</asp:ObjectDataSource>
您如何允许SelectMethod使用StartRowExparameterName/MaximumRowSparNameName和任何其他参数
谢谢问题是
GetCompaniesCount
没有状态
参数,而不是GetCompaniesSubset
如何使用对象数据源
?你使用的是GridView
?谢谢,我昨天看到了这个,我想我怎么会这么愚蠢!我需要读更多!
<asp:GridView ID="gvCompanyIndex" AutoGenerateColumns="true" runat="server" DataSourceID="odsCompaniesIndex"
AllowPaging="true" DataKeyNames="company_id" AllowSorting="true">
</asp:GridView>
public DataSet GetCompaniesSubset(
int startRowIndex, int maximumRows, string sortExpression, bool status)
{...}