Here's an extension method which will probably work as expected:
public static class CheckBoxListExtensions
{
public static string[] CheckBoxList(this HtmlHelper htmlHelper, string htmlName, object dataSource, string textField, string valueField, object selectedValue, RouteValueDictionary htmlAttributes)
{
List<string> list = new List<string>();
Dictionary<object, object> dictionary = MvcControlDataBinder.SourceToDictionary(dataSource, valueField, textField);
foreach (object obj2 in dictionary.Keys)
{
string str = obj2.ToString();
string text = (dictionary[obj2] == null) ? string.Empty : dictionary[obj2].ToString();
bool isChecked = selectedValue.Equals(str);
string item = CheckBoxBuilder.CheckBox(htmlName, text, str, isChecked, htmlAttributes);
list.Add(item);
}
return list.ToArray();
}
}