search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to set calendar to show current date?

Asked by Austin
9 years ago.

I put DateTime.Today in the StartDate field, but I receive "Property value is not valid."

How to I set it to show the current date?

Answer posted by Dan Letecky [DayPilot]
9 years ago.

You have to do it in the code behind, not in the .aspx page:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DayPilotCalendar1.StartDate = DateTime.Today;
            DayPilotCalendar1.DataSource = getData();
            DataBind();
        }
    }
Comment posted by Austin
9 years ago.

I'm using what I assume is the VB equivalent:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If IsPostBack = True Then
DayPilotCalendar1.StartDate = DateTime.Today
DayPilotCalendar1.DataSource = GetDataItem()
DataBind()
End If

End Sub

but it does not work; it sets the dates to "1/1/0001", "1/2/001", etc.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.