Could you help me please? I have in my database MySQL
Bit fields (1), I do the Model
and I work it in the controller with true
or false
( Boolean
), until then everything is fine. In Razor
I call my field like this:
@Html.CheckBoxFor(model => model.Almacenamiento.Value)
In my table MySQL
the values are defaulted to 0, in the view it correctly shows the CheckBox
according to the value of MySQL
, if in MySQL
is at 0 the CheckBox
appears unmarked , if it is 1 the CheckBox
is marked, until then everything is fine.
My problem is when I save or edit, since when I see the view and I want to mark or unmark a CheckBox
in the database to update me, in the controller when the object arrives and I look at that field, that field arrives as null
. I do not know if he let me understand. Some help? What I want is that when editing and saving, the controller reaches its field as true
or false
but only arrives as null
.
This is how it is the properties of the class in my data model:
public Nullable<bool> IngresoSite { get; set; }
public Nullable<bool> IngresoNodoInterconexion { get; set; }
public Nullable<bool> Almacenamiento { get; set; }
public Nullable<bool> PruebaConectividad { get; set; }
public Nullable<bool> IngresoFibraGabinete { get; set; }
public Nullable<bool> IngresoEquipoTX { get; set; }
are several. and that's how I get it in the controller:
[Authorize] [HttpPost] public ActionResult DiagramTransmission (Transmission objTrans) {here I only receive the object and I start to operate, but in the property that mention only appears null. return View (); }
This is how it is the properties of the class in my data model:
public Nullable<bool> IngresoSite { get; set; }
public Nullable<bool> IngresoNodoInterconexion { get; set; }
public Nullable<bool> Almacenamiento { get; set; }
public Nullable<bool> PruebaConectividad { get; set; }
public Nullable<bool> IngresoFibraGabinete { get; set; }
public Nullable<bool> IngresoEquipoTX { get; set; }
are several. and that's how I get it in the controller:
[Authorize] [HttpPost] public ActionResult DiagramTransmission (Transmission objTrans) {here I only receive the object and I start to operate, but in the property that mention only appears null. return View (); }