views:

24

answers:

2

Hello all.

I have the following scenario I would like to implement.

I have a number of drop downs that the client can select a range of criteria. From this, they will press a button, the query will be generated and low and behold, a gridview will be produced in a new window (or at least give that impression) bound by an object datasource. I would also like the user to be able to amend the search numerous times so they can generate a number of new windows/gridviews.

Now then..what would be the best approach for achieving this result?

My initial thinking was to create a querystring generated by the client criteria selections (in the drop down lists), a new page would then take the querystring and populate the gridview here. My concern with this approach is that the query string could be a whopper...are there any disadvantages to creating a ridiculously long query string?

Alternatively, are there any other methods or ideas people have used to produce a similar desired effect?

Any suggests taken on board and all advice warmly received.

A: 

You could handle the button's Click event and store the variables you need in Session object. In the newly opened window with your gridview you take those values and assign them to the proper parameters in your ObjectDataSource's Selecting event.

Jeroen
A: 

There is nothing wrong with a long querystring; it is just not as clean or as easy to use as Jeroen's session-object solution. Save the session object value:

Session("ObjectName") = variablename

Retrieve it:

variablename = Session("ObjectName")

The only reason to use a querystring is if you don't want the session data hanging around, though I can't imagine why that would be an issue.

jason
Would it be possible to have multiple instances of the gridview/window if essentially 'the same' session variables are defined? Would there be a conflict of any sort? Does that even make sense?!
Ricardo Deano
Yes, I see what you mean. It could work as long as you set the session values in the right places. For example, in the click event that opens each popup. That way, the data will be overwritten each time as appropriate.
jason