Skip to content

Twitter Weekly Updates for 2009-09-13

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)
Bookmark and Share
kick it on DotNetKicks.com
Shout it

NOW, FOR A WORD FROM OUR SPONSORS

4 Comments

  1. daoming

    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.

    VA:F [1.9.10_1130]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.10_1130]
    Rating: 0 (from 0 votes)
    Posted on 15-Sep-09 at 10:44 am | Permalink
  2. Graham O'Neale

    @daoming: No problem.

    <%= this.CheckBoxList(x => x.Animals).Id(“AnimalID”).Label(“Selection:”).Options(new MultiSelectList(Model.Animals, “ID”, “Name”)) %>

    Where “Animals” is a collection.

    VN:F [1.9.10_1130]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.10_1130]
    Rating: 0 (from 0 votes)
    Posted on 22-Sep-09 at 7:31 am | Permalink
  3. daoming

    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.

    VA:F [1.9.10_1130]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.10_1130]
    Rating: 0 (from 0 votes)
    Posted on 22-Sep-09 at 7:59 am | Permalink
  4. Graham O'Neale

    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.

    VN:F [1.9.10_1130]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.10_1130]
    Rating: 0 (from 0 votes)
    Posted on 22-Sep-09 at 4:57 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

My name is Graham O'Neale and I'm a software architect from Gold Coast, Australia. I am an overtime thinker, full time coder and awake part time in the real world. I have a keen interest in software development, particularly in the realm of programming (C#, ASP.NET, ASP.NET MVC, LINQ (2 SQL), Entity Framework, Silverlight, Blend, WCF, WPF) and a keen interest in the cutting edge and innovation. I have a new found love for design patterns, ALT.NET practices and well crafted software architecture. The purpose of this blog is to express any thoughts, findings, tips and gripes along my travels in the wonderful world of coding and technology...