A
Alan Silver
Hello,
I have a custom control that displays the date and time. I currently
have properties for the day, month, year, hour and minute, which have to
be set separately. This is inefficient.
I would like to have one property that I can use to pass in a DateTime,
and have the control pull out the various bits from that. I tried ...
public DateTime DateTimeDT {
get {
return new DateTime(m_Year, m_Month, m_Day, m_Hour, m_Minute, 0);
}
set {
m_Year = value.Year;
m_Month = value.Month;
m_Day = value.Day;
m_Hour = value.Hour;
m_Minute = value.Minute;
}
}
but when I try and use this in code ...
DateTimeDT="<%=DateTime.Now()%>"
I get the error "<%=DateTime.Now()%> is not a valid value for DateTime".
Please could someone enlighten me as to a) what I'm doing wrong and b)
the correct/best/easiest way to do this? TIA
I have a custom control that displays the date and time. I currently
have properties for the day, month, year, hour and minute, which have to
be set separately. This is inefficient.
I would like to have one property that I can use to pass in a DateTime,
and have the control pull out the various bits from that. I tried ...
public DateTime DateTimeDT {
get {
return new DateTime(m_Year, m_Month, m_Day, m_Hour, m_Minute, 0);
}
set {
m_Year = value.Year;
m_Month = value.Month;
m_Day = value.Day;
m_Hour = value.Hour;
m_Minute = value.Minute;
}
}
but when I try and use this in code ...
DateTimeDT="<%=DateTime.Now()%>"
I get the error "<%=DateTime.Now()%> is not a valid value for DateTime".
Please could someone enlighten me as to a) what I'm doing wrong and b)
the correct/best/easiest way to do this? TIA