ObjectDataSource.SelectMethod with variable number of parms

C

cenbka

What would be the best approach to following situation:

GridView is bound to ObjectDataSource via DataSourceID pointing to a
processing class. Query to populate ObjectDataSource is based on
user-entered criteria, which is then used in SQL by the method
associated with ObjectDataSource.SelectMethod.
The problem is - user can choose to use several (or none) different
criteria fields. Upon post-back we can custom-tune SelectParameters and
their number, but what do we do with Select method? We can't pass any
classes to it, because Parameter accepts only primitive types (and even
those are in a string format). This leaves us with either declaring
multiple Select methods for all possible number of parameters or encode
all parameters into some class and serialize it to string. Both
approaches seem ugly - any suggestions?


TIA,

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top