Tech Off Post

Single Post Permalink

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

    ZippyV said:
    Maddus Mattus said:
    *snip*

    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.

     

    Example:

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

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

     

    This really ain't rocket science. Tongue Out