Last post Feb 22, 2012 08:37 PM by 13gowthami
Aug 10, 2009 01:21 PM|StievieD|LINK
I'm working my way through the NerdDinner tutorial trying to learn ASP.NET MVC and because I'm more a VB.NET type of person I'm converting the code to VB.NET while reading. But now I'm stuck on creating a populated dropdownlist.
The controller fills the ViewData:
<%= Html.DropDownList("Country", ViewData["Countries"] as SelectList) %>
Aug 10, 2009 01:38 PM|Augi|LINK
<%= Html.DropDownList("Country", TryCast(ViewData["Countries"], SelectList)) %>
Aug 10, 2009 04:38 PM|sjnaughton|LINK
I think vb indexers are more like ViewData("Countries") not using .
Aug 10, 2009 05:20 PM|ZafarYousafi|LINK
U r right. ViewData is of type ViewDataDictionary which is a dictionary and as u have a VB.net background, u definitely know how to handle the dictionaries. (ViewData("item") instead of ViewData["item"])
Aug 10, 2009 05:47 PM|ricka6|LINK
The free C#/VB conversion tools yield
Html.DropDownList("Country", TryCast(ViewData("Countries"), SelectList))
It would be nice to post a good VB version of NerdDinner on codeplex.
Aug 10, 2009 07:22 PM|sjnaughton|LINK
Hi rick that would be a cool resource but my VB skill are poorly lacking [:$]
Aug 10, 2009 07:28 PM|StievieD|LINK
Oh, I feel ashamed it was this easy. Thanks. It must have been a lack of sleep
@ricka6: There is a NerdDinnerVB on CodePlex but it contains only the first steps of the application tutorial. I will finish my conversion as soon as possible and hopefully put it online.
Feb 22, 2012 08:37 PM|13gowthami|LINK
Is there a VB.NET version of NerdDinner, if so can you please post the link?
Thanks in Advance,