New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

A RadDateInput control with an integrated RadCalendar control and an integrated RadTimeView control. This combines the features of RadDatePicker and RadTimePicker in a single control for selecting both a date and a time value.

<p>
       You can find information on the server API of RadDateTimePicker at <a href="https://docs.telerik.com/devtools/aspnet-ajax/controls/datetimepicker/server-side-programming/raddatetimepicker-object"></a>.
   </p>

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("DateTimePicker", typeof(RadDateTimePicker))]
[EmbeddedSkin("DateTimePicker", "Default", typeof(RadDateTimePicker))]
[ToolboxBitmap(typeof(RadDateTimePicker), "Toolbox.Icons.DateTimePicker.png")]
[TelerikToolboxCategory("Date/Color Picker")]
[ValidationProperty("ValidationDate")]
[ControlValueProperty("SelectedDate")]
[ClientScriptResource("Telerik.Web.UI.RadDateTimePicker", "Telerik.Web.UI.Calendar.RadDateTimePickerScript.js")]
[ClientScriptResource("Telerik.Web.UI.RadDateTimePicker", "Telerik.Web.UI.Calendar.RadTimeViewScripts.js")]
public class RadDateTimePicker : RadDatePicker, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, ISkinnableControl, IControl, INamingContainer, IPostBackEventHandler, IPostBackDataHandler

Inheritance: objectControlWebControlRadWebControlRadDatePickerRadDateTimePicker...

Derived Classes: RadTimePicker

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members RadDatePicker.defaultWidthRadDatePicker.OnChildrenCreated()RadDatePicker.OnSelectedDateChanged(SelectedDateChangedEventArgs)RadDatePicker.OnInit(EventArgs)RadDatePicker.CreateChildControls()RadDatePicker.AddAttributesToRender(HtmlTextWriter)RadDatePicker.RenderBrowserSpecificStyles(HtmlTextWriter)RadDatePicker.Render(HtmlTextWriter)RadDatePicker.RenderContents(HtmlTextWriter)RadDatePicker.RangeSelectedDateProperty(DateTime?)RadDatePicker.ConfigureCalendar()RadDatePicker.ConfigureDateInput()RadDatePicker.ControlPreRender()RadDatePicker.Focus()RadDatePicker.Clear()RadDatePicker.DescribeComponent(IScriptDescriptor)RadDatePicker.RegisterCssReferences()RadDatePicker.LoadClientState(Dictionary<string, object>)RadDatePicker.SmartPasteDescriptionRadDatePicker.LocalizationPathRadDatePicker.SupportsRenderingModeRadDatePicker.TagKeyRadDatePicker.BrowserRadDatePicker.CalendarRadDatePicker.DateInputRadDatePicker.DatePopupButtonRadDatePicker.EnabledRadDatePicker.TabIndexRadDatePicker.HiddenInputTitleAttibuteRadDatePicker.WrapperTableSummaryRadDatePicker.WrapperTableCaptionRadDatePicker.PopupDirectionRadDatePicker.EnableScreenBoundaryDetectionRadDatePicker.ZIndexRadDatePicker.EnableShadowsRadDatePicker.SelectedDateRadDatePicker.SkipMinMaxDateValidationOnServerRadDatePicker.InvalidTextBoxValueRadDatePicker.DbSelectedDateRadDatePicker.IsEmptyRadDatePicker.EnableTypingRadDatePicker.ShowPopupOnFocusRadDatePicker.MinDateRadDatePicker.MaxDateRadDatePicker.SharedCalendarIDRadDatePicker.SharedCalendarRadDatePicker.FocusedDateRadDatePicker.RenderModeRadDatePicker.WidthRadDatePicker.ShowAnimationRadDatePicker.HideAnimationRadDatePicker.EnableAriaSupportRadDatePicker.ClientEventsRadDatePicker.OverlayRadDatePicker.ControlIdRadDatePicker.ChildrenCreatedRadDatePicker.SelectedDateChangedWebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.LoadViewState(object)WebControl.TrackViewState()WebControl.MergeStyle(Style)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.SaveViewState()WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SupportsDisabledAttributeWebControl.SkinIDWebControl.TagNameWebControl.ToolTipControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind()Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.OnLoad(EventArgs)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
public RadDateTimePicker()

Properties

Gets or sets a value indicating whether a postback to the server automatically occurs when the user interacts with the control.

C#
[Browsable(false)]
public override bool AutoPostBack { get; set; }
Property Value:

The default value is false.

Overrides: RadDatePicker.AutoPostBack

Setting this property to true will make RadDateTimePicker postback to the server on date selection through the Calendar and Time popups or the DateInput components.

Gets or sets a value indicating whether a postback to the server automatically occurs when the user changes the list selection.

C#
[Browsable(true)]
[Bindable(true)]
[ClientControlProperty]
public virtual AutoPostBackControl AutoPostBackControl { get; set; }
Property Value:

The default value is None

Set this to Both, TimeView or Calendar if the server needs to capture the selection changed event.

This property is effective only for RadDateTimePicker; for RadTimePicker use the AutoPostBack property.

The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()

C#
protected override string CssClassFormatString { get; }

Overrides: RadDatePicker.CssClassFormatString

Example:
C#
protected override string CssClassFormatString
{
       get
       {
           return "RadDock RadDock_{0} rdWTitle rdWFooter";
       }
}

Gets or sets the culture used by RadDateTimePicker to format the date and time value.

C#
public override CultureInfo Culture { get; set; }
Property Value:

A CultureInfo object that represents the current culture used. The default value is System.Threading.Thread.CurrentThread.CurrentUICulture.

Overrides: RadDatePicker.Culture

Example:
cs-api-definition
private void Page_Load(object sender, System.EventArgs e)
{
RadDateTimePicker1.Culture = new CultureInfo("en-US");
}

Gets or sets the value, indicating whether to render the link to the embedded base stylesheet of the control or not.

C#
public override bool EnableEmbeddedBaseStylesheet { get; set; }

Overrides: RadDatePicker.EnableEmbeddedBaseStylesheet

If EnableEmbeddedBaseStylesheet is set to false you will have to register the needed control base CSS file by hand.

Gets or sets the value, indicating whether to render script references to the embedded scripts or not.

C#
public override bool EnableEmbeddedScripts { get; set; }

Overrides: RadDatePicker.EnableEmbeddedScripts

If EnableEmbeddedScripts is set to false you will have to register the needed Scripts files by hand.

Gets or sets the value, indicating whether to render links to the embedded skins or not.

C#
public override bool EnableEmbeddedSkins { get; set; }

Overrides: RadDatePicker.EnableEmbeddedSkins

If EnableEmbeddedSkins is set to false you will have to register the needed CSS files by hand.

Gets or sets the enable client side navigation with keyboard.

C#
public override bool EnableKeyboardNavigation { get; set; }
Property Value:

The enable client side navigation with keyboard.

Overrides: RadDatePicker.EnableKeyboardNavigation

Gets or sets default path for the grid images when EnableEmbeddedSkins is set to false.

C#
public override string ImagesPath { get; set; }
Property Value:

A string containing the path for the grid images. The default is string.Empty.

Overrides: RadDatePicker.ImagesPath

Gets or sets the value, indicating whether to register with the ScriptManager control on the page.

C#
public override bool RegisterWithScriptManager { get; set; }

Overrides: RadDatePicker.RegisterWithScriptManager

If RegisterWithScriptManager is set to false the control can be rendered on the page using Web Services or normal callback requests/page methods.

Gets or sets the reference to the timeview that will be used for picking time. This property allows you to configure several datetimepickers to use a single RadTimeView instance.

C#
[Browsable(false)]
public RadTimeView SharedTimeView { get; set; }
Property Value:

The RadTimeView instance if set; otherwise null;

This property is not accessible from the VS.NET designer and you will have to set it from the code-behind. It should be used when the shared timeview instance is in another naming container or is created dynamically at runtime.

Gets or sets the ID of the timeview that will be used for picking time. This property allows you to configure several datetimepickers to use a single RadTimeView instance.

C#
[TypeConverter("Telerik.Web.Design.TimeViewIdConverter")]
public virtual string SharedTimeViewID { get; set; }
Property Value:

The string ID of the RadTimeView if set; otherwise String.Empty.

RadDateTimePicker will look for the RadTimeView instance in a way similar to how ASP.NET validators work. It will not go beyond the current naming container which means that you will not be able to configure a timeview that is inside a control in another naming container. You can still share a timeview, but you will have to pass a direct object reference via the SharedTimeView property.

C#
protected override bool ShouldRenderAdditionalControls { get; }

Overrides: RadDatePicker.ShouldRenderAdditionalControls

Gets or sets the skin name for the control user interface.

C#
public override string Skin { get; set; }
Property Value:

A string containing the skin name for the control user interface. The default is string.Empty.

Overrides: RadDatePicker.Skin

If this property is not set, the control will render using the skin named "Default". If EnableEmbeddedSkins is set to false, the control will not render skin.

Gets the TimePopupButton instance of the RadDateTimeView control.

C#
[Browsable(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual TimePopupButton TimePopupButton { get; }

You can use the object to customize the popup button's appearance and behavior.

Gets the RadTimeView instance of the datetimepicker control.

C#
[Browsable(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual RadTimeView TimeView { get; }

This property is used by the RadDateTimeInput's internals only. It is subject to change in the future versions. Please do not use.

C#
[Browsable(false)]
public override string ValidationDate { get; }

Overrides: RadDatePicker.ValidationDate

Methods

C#
protected override void AddAdditionalControlComponents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDatePicker.AddAdditionalControlComponents(HtmlTextWriter)

C#
protected override void AddControlComponents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDatePicker.AddControlComponents(HtmlTextWriter)

C#
protected override void CreateTimeControls()

Overrides: RadDatePicker.CreateTimeControls()

C#
protected override void DescribeClientEvents(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDatePicker.DescribeClientEvents(IScriptDescriptor)

C#
protected override void DescribeClientProperties(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDatePicker.DescribeClientProperties(IScriptDescriptor)

C#
protected override void DescribeProperties(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDatePicker.DescribeProperties(IScriptDescriptor)

C#
protected override bool isOnlyInputRendered()
Returns:

bool

Overrides: RadDatePicker.isOnlyInputRendered()

C#
protected virtual void OnItemCreated(TimePickerEventArgs e)
Parameters:eTimePickerEventArgs
C#
protected virtual void OnItemDataBound(TimePickerEventArgs e)
Parameters:eTimePickerEventArgs
C#
protected override void OnPreRender(EventArgs e)
Parameters:eEventArgs

Overrides: RadWebControl.OnPreRender(EventArgs)

C#
protected override void RenderChildren(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDatePicker.RenderChildren(HtmlTextWriter)

C#
protected override void SetDefaultSize()

Overrides: RadDatePicker.SetDefaultSize()

C#
protected override void SetRenderMode(RenderMode mode)
Parameters:modeRenderMode

Overrides: RadDatePicker.SetRenderMode(RenderMode)

C#
protected override DateTime TruncateTimeComponent(DateTime value)
Parameters:valueDateTimeReturns:

DateTime

Overrides: RadDatePicker.TruncateTimeComponent(DateTime)

Events

Occurs on the server when an item in the RadTimeView control is created.

C#
public event RadDateTimePicker.TimeItemEventHandler ItemCreated

The ItemCreated event is raised when an item in the RadTimeView control is created, both during round-trips and at the time data is bound to the control.

The ItemCreated event is commonly used to control the content and appearance of a row in the RadTimeView control.

Example:
cs-api-definition
protected void RadTimePicker1_ItemCreated(object sender, Telerik.WebControls.Base.Calendar.Events.TimePickerEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.CssClass = "TimeCss";
}

if (e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.CssClass = "AlternatingTimeCss";
}
}

Occurs when an item is data bound to the RadTimeView control.

C#
public event RadDateTimePicker.TimeItemEventHandler ItemDataBound

The ItemDataBound event is raised after an item is data bound to the RadTimeView control. This event provides you with the last opportunity to access the data item before it is displayed on the client. After this event is raised, the data item is no longer available.

Example:
cs-api-definition
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void RadTimePicker1_ItemDataBound(object sender, Telerik.WebControls.Base.Calendar.Events.TimePickerEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Controls.Add(new LiteralControl("AlternatingItem"));
}
}
}