Friday, October 10, 2008

SharePoint Date Picker Control

This explains how to use the date picker control that SharePoint provides. This example uses it in a web part.

RenderContents...

DateTimeControl dtcBegin;
DateTimeControl dtcEnd;
dtcBegin = new DateTimeControl();
dtcEnd = new DateTimeControl();
this.Controls.Add(dtcBegin);
this.Controls.Add(dtcEnd);

And to reference the selected date do this:

System.DateTime start = dtcBegin.SelectedDate;
System.DateTime end = dtcEnd.SelectedDate;

1 comment:

electronic signature said...

You just made something that I thought was so difficult be, truly, so easy! Thanks for the post!