I am using ASP.Net MVC with C# language.
I would like to edit a user. The user table has a boolean field called “IsActive”.
In the model, I’m using ADO.Net Entity Data Model.
public ActionResult Edit(int id) {
var editUser = (from u in userEntity.USERs where u.UserId == id select u).First();
return View(editUser);
}
In the view, script generate by Visual Studio for IsActive is using TextBox.
<%= Html.TextBoxFor(model => model.Activate) %>
In this case, I would like to use RadioButton instead with the options Yes and No.
How to do it?
Thanks!
The lambda expressions’ body should be the name of the
IsActiveproperty:<%= Html.CheckBoxFor(model => model.IsActive) %>Also, it seems like you want a
checkboxand not aradio.