I have a form where I have in View:
<div class="col-md-2 form-group">
@Html.LabelFor(x => x.CLIENTEDESDE)
@Html.TextBoxFor(x => x.CLIENTEDESDE, new { @class = "form-control", type = "date" })
@Html.ValidationMessageFor(x => x.CLIENTEDESDE)
</div>
I am returning the data of a DataReader
and when I am going to do the editing of the register, it is not coming filled.
private List<TB_CLIENTE> TransformaReaderEmListaObjetos(SqlDataReader reader)
{
var retornando = new List<TB_CLIENTE>();
while (reader.Read())
{
TB_CLIENTE tabela = new TB_CLIENTE()
{
IDCLIENTE = reader["IDCLIENTE"] == DBNull.Value ? 0 : Convert.ToInt32(reader["IDCLIENTE"]),
NOME = reader["NOME"] == DBNull.Value ? string.Empty : reader["NOME"].ToString(),
APELIDO = reader["APELIDO"] == DBNull.Value ? string.Empty : reader["APELIDO"].ToString(),
CLIENTEDESDE = reader["CLIENTEDESDE"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(reader["CLIENTEDESDE"])
};
retornando.Add(tabela);
}
reader.Close();
return retornando;
}