Closed RyanSeyAG closed 9 years ago
maybe, maybe not. It'd be great to see an example of how you are using this method in the code, what are your values.
@Html.Bootstrap().CheckBoxesFromEnumFor(x=> x.Trial).OrderByValue(true).DisplayInColumns(4, 5, true)
public class HomeViewModelcs
{
public Collection
public enum trial
{
whammy, whammy2
}
the property public Collection Trial { get; set; }
should be of the same type as your enum:
public trial Trial { get; set; }
actually, it should be an Enumerable of that enum:
public List<trial> Trial { get; set; }
i think the model was not getting instantiated before it when. sorry about that. I was on a get and did not think about that
no problem, good luck!
i am getting this error when attempting to use checkboxlistfromenum. Am I missing something from the example
{System.NullReferenceException: Object reference not set to an instance of an object. at TwitterBootstrapMVC.Renderers.Renderer
1.IsSelected(Object value, Enum e, Boolean isIEnumerable, Boolean isArray) at TwitterBootstrapMVC.Renderers.Renderer
1.RenderInputListFromEnum(HtmlHelper1 html, BootstrapInputListFromEnumModel model) at TwitterBootstrapMVC.Controls.BootstrapInputListFromEnumBase
2.ToHtmlString() at System.Web.HttpUtility.HtmlEncode(Object value) at System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content) at System.Web.WebPages.WebPageBase.Write(Object value) at ASP._Page_Views_Home_Index_cshtml.Execute() in d:\Projects - AGOTools\AGORepository\AGO NuGet Packages\AGO.Web.BootstrapMVC.TestProj\Views\Home\Index.cshtml:line 18 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.StartPage.RunPage() at System.Web.WebPages.StartPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)}