Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2007, 10:56 PM
Authorized User
 
Join Date: Jan 2007
Location: , , United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Filter using ObjectDataSource and Custom Objects

Dear All,

I am working on an application and had a situation where I wanted to filter the gridview based on user input (in a textbox). Its not difficult when working with SQLDataSource/DataSets or ObjectDataSource/DataSets etc. I am using Custom Entity classes which are returned by a Data Access class.

What I have done to solve this situation is to create a method in DAL called RetrieveAll(string sortedBy, string Criteria) and have used SelectMethod of ObjectDataSource to point to this method. The Select Parameter gets its value from a control (textbox). Initally the textbox is of course empty and DAL sends all the records. Once you enter something in textbox and say click 'Filter', the textbox value is passed to the DAL through the Select Parameter into the DAL and it gets only filtered records.

I am interested to know whether there is another, possibly better, solution to this issue of filtering ObjectDataSource while using Custom Objects. Please reply to this post if there are solutions for this problem that you know of.

Many thanks to Imar for his suggestions on this topic and specially on urging me to post this issue over the internet :)

Tahir

Reply With Quote
  #2 (permalink)  
Old June 26th, 2007, 06:36 AM
Registered User
 
Join Date: May 2006
Location: chandigarh, , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi tahir,

have u found any other solution to this problem, i m facing same problem. I have multiple controls in filter criteria (like textbox, drop down list etc).

so can u guide me please...

Thanks in advance...

Reply With Quote
  #3 (permalink)  
Old June 30th, 2007, 05:18 PM
Authorized User
 
Join Date: Jan 2007
Location: , , United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have stopped using ObjectDataSource! I found it easy to work without it as there are no design restrictions.

Reply With Quote
  #4 (permalink)  
Old July 2nd, 2007, 04:11 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

How did you pull that off?

I've done some custom control building using Visual Basic Express, but am pretty new to trying to do the same thing in VWD.

Thanks.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
  #5 (permalink)  
Old July 5th, 2007, 04:26 AM
Registered User
 
Join Date: Jul 2007
Location: Gent, , Belgium.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi tna55,

It looks like the project I'm working on at the moment has similar needs, i.e. several search criteria, a button to execute the search and display the results.

I've been going around and around in search of a way on how to do this, but some help would be greatly appreciated. Is there a way you could post or email me how you got it working?
I'm going the DAL route, but I'm curious how you did it...

-- Hans
Reply With Quote
  #6 (permalink)  
Old July 17th, 2007, 01:07 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Hans,

Take a look here:

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

followed by parts two and three.

<shamelessPlug>
My book ASP.NET 2.0 Instant Results uses similar concepts. In the BugBase application chapter, I discuss how to build a Criteria object to do some advanced filtering at the database level.
</shamelessPlug>

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Dynamic Filter on ObjectDataSource onlinedev ASP.NET 2.0 Basics 0 December 5th, 2007 03:21 PM
ObjectDataSource and Smart Objects tna55 ASP.NET 2.0 Basics 0 February 22nd, 2007 07:04 AM
How count #objects of certain type, w/custom ctrl? three ASP.NET 2.0 Basics 1 May 6th, 2006 01:05 PM
Web Service Custom Objects Problem Amateur .NET Web Services 0 March 19th, 2006 11:52 AM
Objectdatasource, Custom Paging, and Filtering crimsondr ASP.NET 2.0 Professional 0 December 23rd, 2005 12:56 PM



All times are GMT -4. The time now is 07:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.