我使用ObjectDataSource对/页面/过滤器进行排序/筛选,如下所示:
<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>使用ObjectDataSource的网格视图:
<asp:GridView ID="gvCompanyIndex" AutoGenerateColumns="true" runat="server" DataSourceID="odsCompaniesIndex"
AllowPaging="true" DataKeyNames="company_id" AllowSorting="true">
</asp:GridView>我想将一些参数(如上面的参数)传入SelectParameters。方法调用'GetCompaniesSubset‘执行,但返回时我得到以下错误:
ObjectDataSource 'odsCompaniesIndex‘找不到具有参数:GetCompaniesCount的非泛型方法“GetCompaniesCount”。
我的SelectMethod是:
public DataSet GetCompaniesSubset(
int startRowIndex, int maximumRows, string sortExpression, bool status)
{...}如何允许StartRowIndexParameterName/MaximumRowsParameterName和任何额外的参数使用SelectMethod?
谢谢
发布于 2011-02-01 15:58:30
问题是GetCompaniesCount没有status参数,而没有GetCompaniesSubset。
https://stackoverflow.com/questions/4863132
复制相似问题