English 中文(简体)
在MVcContrib.FluentHtml.Check BoxList
原标题:Disable a checkbox in a MVcContrib.FluentHtml.CheckboxList

我刚刚开始发现布罗特Hml和Im与BoxList求助器 st。

这里是法典

<ul>
      <%=this.CheckBoxList(m=>m.Filter)
                .Options(criteria.Choices, x => x.Code, x => x.DisplayText)
                .Selected(Model.Filter)
                .Label(criteria.Label).ItemFormat("<li> {0} </li>")

      %>
</ul>

因此,我有一个基于“标准”的核对清单,该清单被归类为清单和编号;ChoiceViewModel>

这里是法典 of a ChoiceViewModel

public class ChoiceViewModel
{
    // Some stuff
    public string Code { get{ return _code; } }
    public string Label { get { return _label; }}
    public string DisplayText { get { return _displayText;}
    }
}

And my problem is : I want to disable the checkbox under a condition.

请允许我指出,如果《守则》不以“A”为起点,那么我就希望打破检查箱。

我如何能够做到这一点?

Thanks, Hasan

问题回答

检查箱没有规定这一点。 你们可以在 lo中与Box一起这样做。 与此类似:

<label>criteria.Label</label> 
<%foreach (var choice in criteria.Choices) {%>
   <li>
      <%=this.CheckBox(m => m.Filter)
         .Value(choice.Code)
         .Checked(choice == Model.Filter)
         .Label(choice.Code.DisplayText)
         .Disabled(choice.Code.StartsWith("A")%>
   </li>
<%}%>




相关问题
Edit links in GridModel (MVCContrib)

MvcContrib GridModel : Is it possible to do ActionSyntax in a GridModel I ve read this article and it s quite useful but I can t apply this. I don t know if in the newest MVCContrib, they removed the "...

how to apply css class to mvccontrib grid

I am using mvccontrib grid in asp.net mvc(C#) application. How can i apply css class to the grid thats created for the mvccontrib grid Attributes? I am looking to construct like: <table border="...

How to use MVC Contrib Grid to make better table?

There are actually 2 question i want to cover in this topic. 1) Is there anyway to put table footer into a MVCContrib Grid? (tf) 2) Im writing a small code to display result image into a grid: -----...

Hierarchical Grid with MVCContrib

I am trying to come up with the best solution for creating a hierarchical grid in my ASP.NET MVC project. First, I looked at jqGrid, and found it s "treeGrid" option which is exactly what I m looking ...

Cannot use fluent html lambda expressions in Spark view

I m attempting to use fluent html and the spark view engine in my asp.net mvc application. I ve assinged the proper base class, added the assemblies, and when i do this.TextBox("MyProperty") it works ...

热门标签