[英]Display date in TextBox with type=“date”
I want to display stored date on database on TextBox
type="date"
我想在TextBox
type="date"
上显示数据库上的存储日期
<asp:TextBox ID="DateStatus" runat="server" Type="date" CssClass="form-control"></asp:TextBox>
but nothing is displayed in the textbox i used. 但我用过的文本框中没有显示任何内容。 I tried this 我试过这个
Dim getdate As Date = DetailTable.Rows(0)(3)
DateStatus.Text= getDate
Also this which i found here 这也是我在这里找到的
Dim getdate As Date = DetailTable.Rows(0)(3)
DateStatus.Text = DateTime.UtcNow.ToString(getdate)
When i debugged the code, the date passed correctly. 当我调试代码时,日期正确传递。
When i remove type="date"
the requested date is displayed just fine 当我删除type="date"
,请求的日期显示得很好
Is it not Possible to do this? 这样做不可能吗?
on SideNote when i generate my table using <Asp:detailsview>
the date is generated with time 12:00:00
despite the field declared only as Date
in the schema, but i don't think it's relevant to my current issue since every thing looked fine during debugging 上的SideNote当我使用生成我的表<Asp:detailsview>
日期与时间产生12:00:00
尽管现场宣布仅Date
的模式,但我不认为这是有关我目前的问题,因为每一件事情调试时看起来很好
And Originally i store the date as Text (@date, DateStatus.Text)
最初我将日期存储为文本(@date, DateStatus.Text)
date (@date, DateStatus.Text)
This is HTML 5 stuff. 这是HTML 5的东西。 If you have a real date from your database, I simulated like this 如果您的数据库中有实际日期,我会像这样模拟
<asp:TextBox ID="txt1" runat="server" TextMode="date" />
Dim d As New Date(1922, 12, 25)
txt1.Text = d.ToString("yyyy-MM-dd")
'displays 12/25/1922
HTML 5 expects a string in the format yyyy-MM-dd and a supporting browser will display depending on Culture setting. HTML 5需要格式为yyyy-MM-dd的字符串,并且将根据“文化”设置显示支持的浏览器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.