Microsoft.SharePoint.WebCon ...


SPDatePickerControl Class (Microsoft.SharePoint.WebControls)

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<DefaultPropertyAttribute("SelectedDate")> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class SPDatePickerControl
    Inherits Control
Visual Basic (Usage)
Dim instance As SPDatePickerControl
C#
[DefaultPropertyAttribute("SelectedDate")] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public class SPDatePickerControl : Control
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPDatePickerControl
       Microsoft.SharePoint.WebControls.SPMonthPickerControl
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Content Master Ltd
SPDatePickerControl

Description

The SPDatePickerControl class displays a calendar control that enables users to select a date, by navigating through the calendar and clicking on specific days.

Usage Scenarios

You will typically use the SPDatePickerControl class to display a calendar in a Web Part or other control, so that users are provided with a rich user interface for selecting dates.

The following code samples show how to instantiate an SPDatePickerControl object in the CreateChildControls method of a Web Part. They then show how to set the calendar type and currently selected date. The samples also show how to invoke the RenderControl method of the SPDatePickerControl class in the RenderControl method of the Web Part.

C# Code Sample

private SPDatePickerControl datePicker;
protected override void CreateChildControls()
{
datePicker = new SPDatePickerControl();
datePicker.Calendar = SPCalendarType.Gregorian;
datePicker.SelectedDate = DateTime.Today.ToLongDateString();
this.Controls.Add(this.datePicker);
}
public override void RenderControl(HtmlTextWriter writer)
{
datePicker.RenderControl(writer);
}

Visual Basic.NET Code Sample

Private datePicker As SPDatePickerControl
 
Protected Overrides Sub CreateChildControls()
datePicker = New SPDatePickerControl()
datePicker.Calendar = SPCalendarType.Gregorian
datePicker.SelectedDate = DateTime.Today.ToLongDateString()
Me.Controls.Add(Me.datePicker)
End Sub
 
Public Overrides Sub RenderControl(ByVal writer As System.Web.UI.HtmlTextWriter)
datePicker.RenderControl(writer)
End Sub
Tags : sharepoint

Page view tracker