Databind on Date AND Time?

Databind on Date AND Time?

Old forum URL: forums.lhotka.net/forums/t/375.aspx


cmay posted on Wednesday, June 14, 2006

Is there a way to databind with a SmartDate so that people can update the date AND the time, aside from giving them a textbox to type out the whole thing e.g. "6/14/2006 2:04 PM"?

I want to use the calendar control, but maybe that isn't an option.

esteban404 replied on Thursday, June 15, 2006

In your public get accessor, set the return value to the format you want:
get{
     return _mySmartDateField.Date.ToShortDateString() + " "  + _mySmartDateField.Date.ToLongTimeString();
}

Or however you want it formatted. The set remains the same and includes the time you're looking to include.

_E

ajj3085 replied on Thursday, June 15, 2006

Alternatively you can set the Format property = "G". 

Copyright (c) Marimer LLC