Tech Off Post

Single Post Permalink

View Thread: ASP.NET MVC MultiSelect issue
  • User profile image
    Sven Groot

    ZippyV said:
    Maddus Mattus said:

    As you can see from my controller action, I don't put anything in the viewdata.


    I've seen people creating a list of SelectListItem using LINQ but they are all in C# and I have no idea how to translate it to VB.NET.



    var friendNames = 
     (from tweet in friendTweets
     select new SelectListItem
      Text = tweet.ScreenName,
      Value = tweet.ScreenName
    // Selected = True|False should also be filled in here

    Dim friendNames = (From tweet In friendTweets _
                       Select New SelectListItem() With _
                       { _
                           .Text = tweet.ScreenName, _
                           .Value = tweet.ScreenName _


    This really ain't rocket science. Tongue Out