Templates – CheckBoxList multiple options: How to model binding and get all options?

This code:

Html.CheckBoxList(ViewData.TemplateInfo.HtmlFieldPrefix, myList)

Generate this markup:


  • BD-Dist BD Name


  • SS-Dist SS Name


  • DS -Dist DS Name


  • SW-Dist SW Name

You can check multiple choices. The return string parameter Header.h_dist_cd contains only the first value selected. I What needs to be done to get the other selected values?

The post method parameters are as follows:

public ActionResult Edit(Header header)

When you have multiple items with the same name, you will use coma to separate their values

This code:

Html.CheckBoxList(ViewData.TemplateInfo.HtmlFieldPrefix, myList)

Generate this markup:


  • BD-Dist BD Name


  • SS-Dist SS Name
  • < br />

  • DS-Dist DS Name


  • SW-Dist SW Name

  • < /ul>

You can check multiple choices. The returned string parameter Header.h_dist_cd only contains the first value selected. What do I need to do to get the other selected values?

The post method parameters are as follows:

public ActionResult Edit(Header header)

When you have multiple items with the same name, you will use coma to separate their values

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2132 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.