Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Filter Expression for ObjectDataSource

Filter Expression for ObjectDataSource

Scheduled Pinned Locked Moved ASP.NET
comdesignsecuritybeta-testinghelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boy pockets
    wrote on last edited by
    #1

    I am using the ObjectDataSource as my DataSource for a GridView. As part of the users functionality, I allow the user to provide text to act as a filter on the GridView. My problem is I don't know of any feasible way to get feedback on the outcome of the 'filter' (i.e. objectDataSource.FilterExpression). In particular, the things I want to know are: 1. if any exceptions have been thrown (i.e. exceptions to do with the data-type of the values, or column names in filter expression), and 2. how many rows the DataSource evaluates to (i.e. there may be a DataSource of 600 records, which having a filter expression applied to it, returns 200 records). Currently, when a new FilterExpression is applied to the ObjectDataSource, the following events are fired: 1. gridViewObjectDataSource_Selected - the select method specified in the ObjectDataSource (gets the whole 'returnValue'; in my case a DataSet). 2. gridViewObjectDataSource_Filtering - the event handler that fires before the filterExpression is applied to the above mentioned return Value. From here, I expected a method to capture the *Filtered event. but there does not seem to be anything to accommodate this. In the doco, there is a Note in the ObjectDataSource.FilterExpression Property entry (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.filterexpression.aspx[^]), that seems to suggest that this functionality is not supported: "You should validate any filter parameter value that you receive from the client. The runtime simply substitutes the parameter value into the filter expression and applies it to the DataSet or DataTable object that is returned by the Select method. If you are using the FilterExpression property as a security measure to limit the number of items that are returned, you must validate the parameter values before the filtering occurs." So my questions are: 1. is there functionality in the ObjectDatSource to get the above mentioned feedback after a FilterExpression is applied? - and if not, 2. Is there a way to determine these details manually? (i.e. get the DataTable, and apply the filterExpression to it in the same way that it is done in the ObjectDataSource?) cheers

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups