At the moment I am making a form in which I hide some fields in order to fill them when editing.
The drawback is that clicking on save generates an error of type La cadena de entrada no tiene el formato correcto.
and is because the fields that I have hidden receive values of type ditetime
, but as I have hidden them I do not add a value of that type of data. What I need to do is send those fields null
to those fields. I tried the following but I still can not get it
if (!string.IsNullOrEmpty(TextBoxFechainicial1.Text))
fc.fecha_cuota_inic1 = DateTime.Parse(TextBoxFechainicial1.Text);'
if (!string.IsNullOrEmpty(TextBoxFechainicial2.Text))
fc.fecha_cuota_inic2 = DateTime.Parse(TextBoxFechainicial2.Text);
How else can I do it?