Tuesday, 3 November 2015

Disable Textbox, disable checkbox, disable radio button, disable dropdown in mvc C#

For Textbox
___________________________________________
@Html.TextBoxFor(m => m.Name, "1", new {  @readonly = "readonly" })

For checkbox
___________________________________________
@Html.CheckBoxFor(m => m.IsActive, new { @disabled = "disabled" })

For radiobutton
___________________________________________
@Html.RadioButtonFor(m => m.EmployeeStatus, "1", new { @id = "Activo", @disabled = "disabled" })<label>True</label>

For dropdown 
___________________________________________
@Html.DropDownList("SelectedCategoryId", new SelectList(Model.AvailableCategories, "Value", "Text", Model.SelectedCategoryId.ToString()), new { @style = " width: 300px;" ,@readonly="readonly"})

No comments:

Post a Comment