2
I am creating a form in Asp where a asp:Textbox
should load the expiry date of a product, which should be filled in page_load() with the database data, and be free to change if necessary
The problem is, with the type="date"
I can’t fill the field in the page’s pageload:
the date the bank returns: {28/02/2020 00:00:00}
Textbox:
<asp:TextBox type="date" id="txtValidade" class="TextBoxSaldo" Width="50%" runat="server" />
Call to fill in the field:
txtValidade.Text = lstValidade[0].DT_VALIDA.ToString("dd/MM/yyyy");
What I’ve already tried:
Change the date format: In that other question, the accepted answer says the problem is in date format, so I tried to change the format to
lstValidade[0].DT_VALIDA.ToString("yyyy/MM/dd")
and did not roll.
Define the Cultureinfo:
in Codebihide I tried to define the formats for "en"
Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-BR");
if I change the input type to text, it works, but I lose the date format function
It worked, only the formatting on
ToString("yyyy/MM/dd")
which, as you said, is with-
and not/
– Gabriel Oliveira
@Gabrieloliveira was my typo, the intention was
-
same, as I did in the first HTML, edited, now should be OK– Guilherme Nascimento