I have a form with some controls .Here I have a checkbox(on the view).In controller I call 2 functions : one for getting saved values and one for saving values. Tis functions works fine , but on my form I have always true , even it in my class I have false.
In controller I have :
return View("Settings", (K.NotificationsSettings)comm.Result);
// comm.Resultset return false form my gfield called Enabled
K.NotificationsSettings is a class which have this structure :
[DataContract] public class NotificationsSettings {
[DataMember] public bool Enabled; [DataMember] public int Interval; }
In my view first line is :
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Child.Master" Inherits="System.Web.Mvc.ViewPage<K.NotificationsSettings>" %>
and code for this checkbox is :
< input id="Enabled" checked="checked" type="checkbox" name="Enabled" value ="<%=Model.Enabled%>"/>
But my checkbox is always true .
Is necessary to put this "=Model.Enabled%>" ? Can somebody help me?