Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
Old November 1st, 2015, 02:44 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
The Following User Says Thank You to Imar For This Useful Post:
Grodnik (November 8th, 2015)
 
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.)




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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.