I have a site running with ASP.NET MVC 1 and have encountered a bug where a bool in my model is being reset to default because the value is not used in the view.
The code for the Controller:
public ActionResult Edit(Guid id)
{
Service service = GetService(id);
if (service == null)
return View("NotFound");
return View(service);
}
when the view code had:
<label for="IsActive"> Is Active: </label>
<%= Html.TextBox("IsActive") %>
it was working fine however once it was deleted the isactive field was always returned as false. I no longer want the isactive to be seen or modified from this view but removing it has caused the value to be lost, i have tried setting the value and not displaying it with
<% Html.TextBox("IsActive"); %>
but that still had it defaulting the value to false
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Service service)
{
//UpdateLogic
}
in the post method, regardless what IsActive had been before, the Service.IsActive is always false
basically i was just wondering how i could get the site to keep the value it was passed without displaying the text box in the view (have tried googled but failed to get the right combination of words for a decent result)