I have a custom control that print the current date into the page. The control has a Format property for setting witch DateTime property to be printed. (Date, Day, Year etc...)
<TSC:DateTimeWriter runat="server" Format="Year" />
But what i want is when i type :
Format="
I want to show a list of all the possible values(Using Visual Studio).
The cs code:
public class DateTimeWriter : Control
{
public string Format { get; set; }
protected override void Render(HtmlTextWriter writer)
{
writer.Write(writeDateTime());
}
private string writeDateTime()
{
var now = DateTime.Now;
switch (Format)
{
case "Year":
return now.Year.ToString();
case "Day":
return now.Day.ToString();
etc...
default:
return now.ToString();
}
}
}