Hi,
I am trying out this tutorial found here : http://msdn2.microsoft.com/en-us/library/bb445510.aspx#aspnett25cstpgvb_topic4
on implementing custom paging using dal and gridview.
However,I tried changing it slightly by putting a textbox to do some filtering instead of returning the full database.
As a result, my BLL for returning products paged will look like this :
This is how my page look like :
Running the code will return this error : ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetProductsPaged' that has parameters: searchword.
Been trying this for days,but could not find the problem. Could someone pls help? Thanks!
I am trying out this tutorial found here : http://msdn2.microsoft.com/en-us/library/bb445510.aspx#aspnett25cstpgvb_topic4
on implementing custom paging using dal and gridview.
However,I tried changing it slightly by putting a textbox to do some filtering instead of returning the full database.
As a result, my BLL for returning products paged will look like this :
VB.NET:
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, False)> _
Public Function GetProductsPaged(ByVal startRowIndex As Integer, ByVal maximumRows As Integer,ByVal searchword As String) As Northwind.ProductsDataTable
Return Adapter.GetProductsPaged(startRowIndex, maximumRows,searchword)
End Function
VB.NET:
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Search" /><br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID"
DataSourceID="ObjectDataSource1" AllowPaging="True">
<Columns>
<asp:BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" />
<asp:BoundField DataField="CategoryName" HeaderText="Category" ReadOnly="True" SortExpression="CategoryName" />
<asp:BoundField DataField="SupplierName" HeaderText="Supplier" SortExpression="SupplierName" />
<asp:BoundField DataField="QuantityPerUnit" HeaderText="Qty/Unit" SortExpression="QuantityPerUnit" />
<asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" HeaderText="Price"
HtmlEncode="False" SortExpression="UnitPrice" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetProductsPaged" TypeName="ProductsBLL" EnablePaging="True" SelectCountMethod="TotalNumberOfProducts">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="searchword"
PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
</form>
Been trying this for days,but could not find the problem. Could someone pls help? Thanks!