Wrox Programmer Forums
|
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 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 January 28th, 2010, 06:39 PM
Authorized User
 
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default DropDownList not showing correct value

In editarticle.aspx I have
Code:
<%= Html.DropDownList("categoryID", (IEnumerable<SelectListItem>)ViewData["CategoryID"], new { @class = "textbox" }) %>
and in the ActionResult I have

Code:
ViewData["CategoryID"] = new SelectList(categories, "CategoryID", "Title", article.CategoryID);
which should in the last parameter use the article.CategoryID as it's selected value.

However, when the page loads it's not selecting the correct category.
Is there something wrong with the code?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting the correct records rstelma SQL Server 2000 12 May 8th, 2009 05:35 PM
ListBox not showing correct selected value Shokwave ASP.NET 2.0 Basics 4 June 4th, 2007 08:23 AM
Is it correct like this ? tunisiano C# 1 March 7th, 2007 12:22 PM
Correct code stefanocinfo BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 October 4th, 2006 03:06 AM
correct syntax? crmpicco Classic ASP Basics 2 February 10th, 2005 05:32 AM





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