- Just bought Braid! 66% off Weekend Deal! http://store.steampowered.com/app/26800/ #
- I ran 1790m before hitting a wall and tumbling to my death in Canabalt. http://bit.ly/qz8HT (Can't wait for the iPhone version!!) #
- I wish IRC was in. #Year2000 #
- Listening to #NovaNation Top 5! http://www.novanation.com.au #
- Tried a Redback Wheat Beer, not too fussed. #
Pages
Blogroll
-
RSS Links
My Tweets
- GONeale earned the Suspicious badge for Visual Studio Achievements: http://t.co/apqgBwgt via @ch9 #VSAchievements 2 weeks ago
- Seriously?! I never thought I would see this, but I guess I'm going to have to install.. :p http://t.co/bu93W9kN #VisualStudio #Achievements 2 weeks ago
- Calling all Aussies, have you checked out my new start-up? http://www.stayoftheday.com Would REALLY appreciate the support, share and earn credit! 3 weeks ago
- It's been a long time coming! I'm proud to announce my startup @StayOfTheDay pre-launch! Check it out, $500k giveaway http://t.co/nmh4rFp4 2012-01-11
- Woohoo! I just got my slice of the @StayOfTheDay $500K giveaway, no more full price accommodation for me! Got yours? http://t.co/nmh4rFp4 2012-01-11
- Wow! Database Schema and Data Compare has been in Visual Studio since 2008?? I never got THAT memo! http://t.co/TcWNZ3Tt #VisualStudio #.NET 2011-12-22
- More updates...
Advertisment
4 Comments
Hi Graham,
I found you through the codeplex. I am currently having a problem to create a checkboxlist in MVC with MvcContrib.
Would it be possible for you to help me to create small demo for me?
daoming.
@daoming: No problem.
<%= this.CheckBoxList(x => x.Animals).Id(“AnimalID”).Label(“Selection:”).Options(new MultiSelectList(Model.Animals, “ID”, “Name”)) %>
Where “Animals” is a collection.
Hi Graham,
Thank you for the help.
But how can we define the the checkbox will be checked, if we read the data from the database?
Many thanks.
Daoming.
I’m not at a location I can debug at, but off the top off my head:
< %= this.CheckBoxList(x => x.Animals).Id(”AnimalID”).Label(”Selection:”).Options(new MultiSelectList(Model.Animals, “ID”, “Name”, Model.User.SelectedAnimals.Select(x => x.AnimalID))) %>
Where “User.SelectedAnimals” is the narrowed down list of ‘selected’ animals for each user.
You may also want “LabelAfter” rather than “Label” to position your checkbox text to a more common location.
And an example of “Checkbox” only I had laying around:
< %= this.CheckBox("User.UserRoleMappings[" + i + "].UserRoleID").LabelAfter(userRole.Name).Checked(Model.User.UserRoleMappings.Any(x => x.UserRoleID.Equals(userRole.ID))).Value(userRole.ID)%>
I might actually do a review on all the controls in FluentHtml, so keep a look out…
Also check out http://www.stackoverflow.com, there are lots of people there that can help with further MVC/contrib questions.
Post a Comment