mardi 6 novembre 2018

Disabled attribute not showing up on Html.Checkbox

I am trying to display but disable checkboxes in MVC (I am aware that disabled checkboxes will still postback with a value of false). However, I cannot get the checkboxes to be disabled.

Even adding the disabled attribute directly, the checkboxes remain enabled.

tableStyle: "table table-striped table-hover",
                fillEmptyRows: false,
                columns: grid.Columns
                    (
                    grid.Column("EnterpriseRxPlanID", canSort: false, format: (item) => Html.CheckBox("EnterpriseRxPlanID", isChecked: (bool)item.IsSelected, htmlAttributes: new { @class = "form-control wp-check-erxpid", disabled = "" }), header: "Select"),

...

I've tried disabled = "true", @disabled = "", @disabled = true, etc, and the attribute is imply not rendered in the page. If I add a new class, it shows up, so I know the page is being refreshed properly.

Any input is welcome, seems like such a small issue but I am befuddled.




Aucun commentaire:

Enregistrer un commentaire