简体   繁体   中英

ASP.NET Binding two textbox controls for time display/edit

I have a DetailsView control that is bound to a single table in my database. one of the fields in the DB is a DATETIME field which represents the TIME of something (i'm not using the date...)

I want two textboxes in my template field that will bound to this time data, one for Hours and second for Minutes.

What is the easiest way to do that?

first TextBox for hours(24h format):

Text='<%# Eval("DateTimeField", "{0:HH}") %>'

second TextBox for minutes:

Text='<%# Eval("DateTimeField", "{0:mm}") %>'

Custom DateTime Format Strings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM