Unable to write to asp.net textbox control with the html5 “date” type

后端 未结 2 741
灰色年华
灰色年华 2021-01-04 23:59

I have an asp.net page with a an html5 TextBox control set as the \"date\" type. The control on my page looks like this:



        
2条回答
  •  一生所求
    2021-01-05 00:23

    This is actually the correct way to set the date but the format was wrong!

    TextBoxMyDate.Text = DateTime.UtcNow.ToString("yyyy-MM-dd");
    

    I was confusing how the browser displays the date and the html5 standards for this control!

提交回复
热议问题