Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 March 30th, 2012, 06:47 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default 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.
Reply With Quote
  #2 (permalink)  
Old March 31st, 2012, 11:28 AM
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

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old March 31st, 2012, 01:23 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default 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.
Reply With Quote
  #4 (permalink)  
Old March 31st, 2012, 02:13 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default I guess the question that I have then is.....

Quote:
Originally Posted by Imar View Post
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?

Last edited by vbboyd; March 31st, 2012 at 02:18 PM..
Reply With Quote
  #5 (permalink)  
Old April 1st, 2012, 03:20 AM
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

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
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
Basic GridView Question norwell BOOK: Beginning Android Application Development 2 December 18th, 2011 05:38 PM
The GridView 'GridView' fired event PageIndexChanging which wasn't handled Phil Critchley ASP.NET 4 General Discussion 10 February 19th, 2011 09:55 AM
Databind a gridview question. chobo2 ASP.NET 3.5 Basics 4 March 8th, 2009 04:38 PM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
HELP!!! (DropdownList in GridView question) Aaron Edwards ASP.NET 2.0 Basics 10 June 25th, 2006 05:08 AM



All times are GMT -4. The time now is 03:05 PM.


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