Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?
 


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
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



All times are GMT -4. The time now is 08:12 PM.


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