problems with ObjectDataSource and filtering

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I am trying the new ObjectDataSource from ASP.NET 2.0. I connected a
Gridview with ObjectDataSource which is connected to a webservice which
returns a DataSet. In the Webmethod I return only the rows for the
current page because paging is enabled, I use the parameters
maximumRows and startRowIndex for doing this. I also got sorting to
work using the parameter sortExpression.

The method of the webservice looks like this:

[WebMethod(Description = "")]
public DataSet GetDataSet(int maximumRows, int startRowIndex, string
sortExpression)
{
....

return dsPagedPortCodes;
}

[WebMethod(Description = "")]
public int GetNumberOfRows()
{
....

return ds.Tables[0].Rows.Count;
}

The description of the ObjectDataSource looks like this:

<asp:ObjectDataSource
ID="ods" runat="server" MaximumRowsParameterName="maximumRows"
StartRowIndexParameterName="startRowIndex"
SortParameterName="sortExpression"
EnablePaging="True" SelectMethod="GetDataSet"
SelectCountMethod="GetNumberOfRows"
TypeName="WSService.wsWebservice"
</asp:ObjectDataSource>

Paging and sorting works but now I want to be able to get filtering
works, the returned DataSet contains one table with 4 columns and I
want to be able to filter on each column.

What do I have to change to the webmethod and the ObjectDataSource to
get filtering to work?

Thanks a lot,
kind regards,
Bert Janssens

.



Relevant Pages

  • Re: Problem with updating record with objectdatasource
    ... One thing I have found out is that the name of the parameter variables that your web service method accepts should be identical to the names of the bound column names. ... If you have a colum data field called ID and firstName (these are listed in the objectDataSource parameters) then your webservice method should have these exact parameter names void update, etc. ... and an objectdatasource (in my presentation layer). ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Sort GridView without DataSourceControl
    ... I took your advices and used ObjectDataSource, but it's too much of a pain, ... for example you can't use Objects and use Filtering, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Binding optional parameters
    ... I have a web page with various controls that supply parameters to an ... ObjectDataSource. ... filtering of the results...GetProductsByID, GetProductsByIDAndDate...etc ...
    (microsoft.public.dotnet.framework.aspnet)
  • Datasource FilterExpression fails for string fields
    ... I have a Gridview which is filled from an objectdatasource. ... filtering - which works perfectly when the field to be filtered is an ... ive tried creating a FilterParamater as well, but it also fails ...
    (microsoft.public.dotnet.framework.aspnet)