Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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 October 31st, 2015, 10:49 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2015
Location: rural Minnesota
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Default Set default of GenreList?

Page 582: If it's not a postback but the ID = -1 and I'm adding a new review, how do I set a default value for genre? Also, how do I eliminate a genre option?

Last edited by Grodnik; November 1st, 2015 at 12:04 PM.. Reason: update
Reply With Quote
  #2 (permalink)  
Old November 1st, 2015, 02:44 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

With pretty much the same code as on page 582, but then you would pass in your own genre ID to FindByValue instead of retrieving one from the review.

How to exclude genres depends. One way would be to add some kind of flag in the database and then update your LINQ or SQL queries to skip items with a specific value.

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
The Following User Says Thank You to Imar For This Useful Post:
Grodnik (November 8th, 2015)
  #3 (permalink)  
Old November 7th, 2015, 03:03 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2015
Location: rural Minnesota
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Thank you, Imar! I like to avoid flags, but in this case it was a great suggestion. If the flag is set, I can actually skip the dropdown entirely and set the default in the code. (although it took a while to realize that I had to include runat server for the table row - it's a steep learning curve.)
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
Set Custom Branding as Default StevenAdams BOOK: Professional SharePoint 2010 Branding and User Interface Design 2 January 21st, 2011 06:34 PM
how do i set default parameter value.. rupen Classic ASP Basics 5 January 5th, 2007 12:14 AM
how to set default value to datetimepicker control xshelp General .NET 1 December 8th, 2005 10:09 PM
how to set parameter default value oranginalab Classic ASP Basics 0 August 28th, 2003 02:53 AM



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


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