PDA

View Full Version : Bypassing Recordset Filtering



sladmin
21-03-2008, 02:56 PM
Hiya,

I have a recordset that filters using a Querystring. However, when the page first loads, I want the filtering to disappear. I have a field called Priority which filters my records, but when the page first loads I want all records to display, and not just the ones that the default value is set as.

Any ideas on how to do this? If you need more info let me know :)

TIA,

siphilp
21-03-2008, 03:01 PM
You could store the querystring in viewstate or a hidden control and return all the data you need from the database.
If you want to then filter on all the data you can use

http://msdn2.microsoft.com/en-us/library/system.data.datatable.defaultview.aspx

Hope this helps. Any probs let me know :)

sladmin
21-03-2008, 03:06 PM
Thanks for your reply Simon,

Is that for .net? I forgot to mention that I'm using ASP VB (I know, old now) :D.

Thanks,

siphilp
21-03-2008, 03:08 PM
Ah,
Could you not use a Request.Querystring statement so if the querystring is null return all records else return filtered view?

sladmin
21-03-2008, 03:11 PM
Ah,
Could you not use a Request.Querystring statement so if the querystring is null return all records else return filtered view?

Hmm... possibly. I thought about creating two recordsets, and hide each one when I don't need them although the second one which would not be filtered would always show.

Plus doing it that way would put more strain on the server loading times.

siphilp
21-03-2008, 03:15 PM
You could ajax it or use some funky client side javascript sorting. (Accessibility problems)

Could get complicated :S

sladmin
21-03-2008, 03:17 PM
You could ajax it or use some funky client side javascript sorting. (Accessibility problems)

Could get complicated :S

I was hoping someone wasn't going to say that :gagged: :unsure:

I'll have a digg around on Google, there must be something around. I don't really want to get too complicated, as it puts extra load on the page, and as you say would cause accessability problems.

siphilp
21-03-2008, 03:24 PM
I think the cleanest would be an if else and use 2 calls.

You could always use a nice sql query that returns a set of rows based on the page number so your not pulling back all of them :)

For example page size is 15. First Call no querystring would be something like

Select top 15 from tblExample where Title = 'Hello world'

no querystring selecting page 2.

http://www.4guysfromrolla.com/webtech/062899-1.shtml

if the querystring exists then you could call the same as above but with you where clause :)

How many records are we talking?

siphilp
12-04-2008, 08:19 AM
sladmin saw this thought of you :whistle:

http://webplicity.net/flexigrid/