Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7814321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:09:38+00:00 2026-06-02T05:09:38+00:00

I am developing an ASP.Net MVC 3 Web application and I recently posted a

  • 0

I am developing an ASP.Net MVC 3 Web application and I recently posted a question about how to display a checkboxlist

ASP.Net MVC 3 Retrieve Checkbox List Values

and thanks to the help from RubbleFord and Darin Dimitrov I was able to get this working.

This works nicely for one checkboxlist, however, I now need to be able to display several checkboxlists on the same View, ie, see image attached.

enter image description here

The ViewModels I use to currently display one list are as follows;

public class ViewModelShiftSubSpecialties
{

    public ListItem specialtyName { get; set; }
    public IEnumerable<ViewModelCheckBox> SubSpecialityList { get; set; }

}

public class ViewModelCheckBox
{
    public string Id { get; set; }
    public string Name { get; set; }
    public bool Checked { get; set; }
}

And within my Controller I populate ViewModelShiftSubSpecialties like so:

var subSpecialties = GetSubSpecialtiesForSpecialty(5);

        ViewModelShiftSubSpecialties viewModel = new ViewModelShiftSubSpecialties();

        var checkBoxList = new List<ViewModelCheckBox>();

        viewModel.specialtyName = _listService.GetListItemByID(5); //Medicine Specialty

        foreach (var item in subSpecialties)
        {
            ViewModelCheckBox chkBox = new ViewModelCheckBox { Id = item.subID.ToString(), Name = item.ListSub.description, Checked = false };
            checkBoxList.Add(chkBox);
        }

        viewModel.SubSpecialityList = checkBoxList;

In my View, I display the list name and also use an Editor template to display the checkboxlist

<h3>@Model.specialtyName.description</h3>
@Html.EditorFor(m => m.SubSpecialityList)

However, I am totally stumped as how to get the above code to work with multiple checkboxlists on one View. Is this even possible?

I would really appreciate if someone could please help me with this.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:09:40+00:00Added an answer on June 2, 2026 at 5:09 am

    It looks like you’ve done all the work already. You already have an Editor Template that works correctly with a ViewModelCheckBox IEnumerable. Editor templates wouldn’t be useful if you couldn’t reuse them for the same datatype. You just need to use it three times. Just extend your ViewModel

    public class ViewModelShiftSubSpecialties
    {
        public ListItem specialtyName { get; set; } //Might need 3 of these
        public IEnumerable<ViewModelCheckBox> SubSpecialityList1 { get; set; }
        public IEnumerable<ViewModelCheckBox> SubSpecialityList2 { get; set; }
        public IEnumerable<ViewModelCheckBox> SubSpecialityList3 { get; set; }
    }
    

    Create all three in your controller (and give them better names then I did).

    And then in your View

    @Html.EditorFor(m => m.SubSpecialityList1)
    @Html.EditorFor(m => m.SubSpecialityList2)
    @Html.EditorFor(m => m.SubSpecialityList3)
    

    Alternatively you could create a class that contains a single specialty name and IEnumerable ViewModelCheckBox, and have your ViewModel have an IEnumerable of this new class. Then create a new Editor Template for this new class. I think this is worth it if your list size is variable/ might change. Otherwise I’d use the earlier solution for a simple fix.

    public class ViewModelShiftSubSpecialties
    {
        public class IEnumerable<SubSpecialty> { get; set; }
    }
    
    public class SubSpecialty
    {
        public ListItem specialtyName { get; set; }
        public IEnumerable<ViewModelCheckBox> SubSpecialityList
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a general question, I'm developing an ASP.NET MVC 3 web application that reads
I am developing an ASP.Net MVC 3 Web application with Entity Framework 4.1 and
I am developing an ASP.Net MVC 3 Web application using Entity Framework 4.1 and
I am developing an ASP.Net MVC 3 Web application using Entity Framework 4.1, however,
I am developing an ASP.Net MVC 3 Web application and I am having some
I'm developing a web application using ASP .NET MVC 1.0 and jQuery (including the
I'm developing a ASP.NET MVC 2 web application. So far, I managed to define
I am developing an asp.net mvc 2 web application. My clients will most likely
I'm developing a web application using asp.net Mvc 2 and NHibernate, and I'm paging
I'm developing an web application using asp.net mvc, and i need to do a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.