2
我使用一个ObjectDataSource排序/页/如下过滤器:的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>
GridView的消费ObjectDataSource控件:
<asp:GridView ID="gvCompanyIndex" AutoGenerateColumns="true" runat="server" DataSourceID="odsCompaniesIndex"
AllowPaging="true" DataKeyNames="company_id" AllowSorting="true">
</asp:GridView>
我想在数传像上面那样的参数放入SelectParameters中。该方法调用GetCompaniesSubset“执行,但在返回我收到以下错误:
ObjectDataSource 'odsCompaniesIndex' could not find a non-generic method 'GetCompaniesCount' that has parameters: status.
我SelectMethod是:
public DataSet GetCompaniesSubset(
int startRowIndex, int maximumRows, string sortExpression, bool status)
{...}
你如何让SelectMethod利用StartRowIndexParameterName/MaximumRowsParameterName任何额外的参数?
感谢
你如何使用ObjectDataSource?你在使用`GridView`吗? – 2011-02-01 14:51:13
对不起,我会编辑我的文章! – adamwtiko 2011-02-01 15:10:22