p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=560)
-   -   The gridview question. (http://p2p.wrox.com/showthread.php?t=87142)

vbboyd March 30th, 2012 06:47 PM

The gridview question.
 
Hypothetical question...........
Lets just say for instance that your company, Imar Productions, wants to look at customer orders on a webform using a gridview. So lets say for instance that the managers of your company would like to look at customer order information based on certain criteria. Like say for instance the managers of your company would like to look at customer information based on the state that the customers reside in like Wyoming or Indiana. Or they would like to look at customer order information based on the regional areas that are based on zip code. Or they would like to look at customer order information based on items that were sold like, CDs, Tshirts, Concert Posters etc,etc. Or they would like to see customer information based on the dollar size of the customer order within certain ranges like over 500 dollars or more than 1000 dollars or less than 100 dollars etc. etc.
So suppose you have drop down list boxes for each of these criteria that are used to displayed customer order database information in the gridview. You would have one drop down list box for the type of merchandise ordered, another one for the customer dollar amount with various different dollar value ranges, another drop down list box with the customer order zip code and another for the state the customer order originated from, so that say for instance the managers of your company could look all the customers in Oregon who had orders of over 500 dollars. Or for instance the managers of your company might like to look at Customers in Wyoming who ordered at least $100 worth of Tshirts.
Using the smart tag on the Grid View to launch the wizard is there any way to attach it to all of these drop list boxes at once to display information in the gridview that is chosen by the managers of your company so that any given random selection criteria based on information contained in the drop list boxes will be put into the SQL statement that displays the information in your gridview? In other words is there any way to dynamically create database information using drop down list boxes to be displayed in something like a gridview? Refresh my memory please do you do anything like this in your book anywhere? Forgive me because I can't recall every example that you have in your rather large voluminous and informative book.

Thanks once again.

PS I thought that this question might be a good example of real life issue that you might like to include any future books on ASP.NET that you might write.

Imar March 31st, 2012 11:28 AM

Pfff, what a long story for a question like "Hey, how do I filter a GridView. You almost lost me half way down the question.

Anyway, take a look here: http://www.4guysfromrolla.com/articles/081110-1.aspx

In addition, take a look at Filtering Data on page 446 and further. It's not as advanced as the QueryExtender control but it may be enough in many cases.The example shows one drop down, but it can easily be extended with more, or other controls.

Cheers,

Imar

vbboyd March 31st, 2012 01:23 PM

Okay
 
Sorry I was just trying to couch the question in terms of a real world example which I think might be more helpful to people so that they can understand things in terms that they deal with on a regular daily basis. I will endeavor to try to be more succinct and specific from now on.

vbboyd March 31st, 2012 02:13 PM

I guess the question that I have then is.....
 
Quote:

Originally Posted by Imar (Post 282985)
Pfff, what a long story for a question like "Hey, how do I filter a GridView. You almost lost me half way down the question.

Anyway, take a look here: http://www.4guysfromrolla.com/articles/081110-1.aspx

In addition, take a look at Filtering Data on page 446 and further. It's not as advanced as the QueryExtender control but it may be enough in many cases.The example shows one drop down, but it can easily be extended with more, or other controls.

Cheers,

Imar

If I have four drop down list boxes used to filter data to a gridview, which are selected radomly by the user to display the data that the user wants to see displayed in the gridview, do I set all four drop down list box properties to enable postback = true? I think that is where I was really getting confused about the whole issue. Because once you make a selection in the list box and the post back enabled property is equal to true it immediately pulls back the information and puts the filtered data into the gridview to be displayed does it not? Please correct me if I am wrong about this. In this particular instance you don't want to post back until the user is ready to make the filter selection(s) for the data that user wants to be displayed in the gridview based on what the user has or has not chosen in the multiple listboxes is that not correct?

Imar April 1st, 2012 03:20 AM

Quote:

In this particular instance you don't want to post back until the user is ready to make the filter selection(s)
This is a design choice you need to make. You can use AutoPostBack on the controls and get direct filtering on the controls you selected so far.

if you don't want that, just add a button or an image to the page that triggers the data binding when clicked. This way the user can make the selection and then press a button to query for the data.

Cheers,

Imar


All times are GMT -4. The time now is 10:16 PM.

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