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

RadDateRangePicker class

You can find information on the server API of RadDateRangePicker at .

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("DateRangePicker", typeof(RadDateRangePicker))]
[EmbeddedSkin("DateRangePicker", "Default", typeof(RadDateRangePicker))]
[ToolboxBitmap(typeof(RadDateRangePicker), "Toolbox.Icons.DateRangePicker.png")]
[TelerikToolboxCategory("Date/Color Picker")]
[ValidationProperty("IsEmpty")]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadDateRangePicker))]
[ControlValueProperty("SelectedDate")]
[ClientScriptResource("Telerik.Web.UI.RadDateRangePicker", "Telerik.Web.UI.Calendar.RadDateRangePicker.js")]
[RequiredScript(typeof(jQuery))]
[RequiredScript(typeof(MaterialRipple))]
public class RadDateRangePicker : RadWebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, ISkinnableControl, IControl, INamingContainer, IPostBackEventHandler, IPostBackDataHandler

Inheritance: objectControlWebControlRadWebControlRadDateRangePicker

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members WebControl.AddAttributesToRender(HtmlTextWriter)WebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.LoadViewState(object)WebControl.TrackViewState()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.RenderContents(HtmlTextWriter)WebControl.SaveViewState()WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SupportsDisabledAttributeWebControl.SkinIDWebControl.TabIndexWebControl.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.OnPreRender(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 RadDateRangePicker()

Fields

C#
protected Unit defaultWidth

Properties

C#
protected HttpBrowserCapabilities Browser { get; }

Gets the RadCalendar instance of the datepicker control.

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

Gets or sets an instance of DatePickerClientEvents class which defines the JavaScript functions (client-side event handlers) that are invoked when specific client-side events are raised.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public DateRangePickerClientEvents ClientEvents { get; }
C#
public string ControlId { get; }

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: RadWebControl.CssClassFormatString

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

Gets or sets the culture used by RadDatePickers and RadCalendar inside the RadDateRangePicker to format the date.

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

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

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

Gets or sets the date content of RadDateRangePicker in a database friendly way.

C#
[Browsable(false)]
[TypeConverter(typeof(DateTimeConverter))]
[Bindable(true, BindingDirection.TwoWay)]
public virtual object DbRangeSelectionEndDate { get; set; }
Property Value:

A DateTime object that represents the selected date. The default value is null (Nothing in VB).

This property behaves exactly like the SelectedDate property. The only difference is that it will not throw an exception if the new value is null or DBNull. Setting a null value will internally revert the SelectedDate to the null value, i.e. the input value will be empty.

Example:
cs-api-definition
private void Page_Load(object sender, System.EventArgs e)
{
RadDateRangePicker1.DbSelectedDate = tableRow["BirthDate"];
}

Gets or sets the date content of RadDateRangePicker in a database friendly way.

C#
[Browsable(false)]
[TypeConverter(typeof(DateTimeConverter))]
[Bindable(true, BindingDirection.TwoWay)]
public virtual object DbRangeSelectionStartDate { get; set; }
Property Value:

A DateTime object that represents the selected date. The default value is null (Nothing in VB).

This property behaves exactly like the SelectedDate property. The only difference is that it will not throw an exception if the new value is null or DBNull. Setting a null value will internally revert the SelectedDate to the null value, i.e. the input value will be empty.

Example:
cs-api-definition
private void Page_Load(object sender, System.EventArgs e)
{
RadDateRangePicker1.DbSelectedDate = tableRow["BirthDate"];
}

When set to true enables support for WAI-ARIA

C#
public bool EnableAriaSupport { get; set; }

Gets or sets a value indicating whether the Web server control is enabled.

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

true if control is enabled; otherwise, false. The default is true.

Overrides: RadWebControl.Enabled

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: RadWebControl.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: RadWebControl.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: RadWebControl.EnableEmbeddedSkins

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

Gets or sets whether the screen boundaries should be taken into consideration when the Calendar or TimeView are displayed.

C#
[ClientControlProperty]
[ClientPropertyName("_enableScreenBoundaryDetection")]
public bool EnableScreenBoundaryDetection { get; set; }

Gets or sets whether popup shadows will appear.

C#
[ClientControlProperty]
[ClientPropertyName("_enableShadows")]
public bool EnableShadows { get; set; }

Gets the end RadDatePicker instance of the daterangepicker control.

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

Gets or sets the title attribute for the hidden field.

C#
public virtual string HiddenInputTitleAttibute { get; set; }
Property Value:

The default value is "Visually hidden input created for functionality purposes.".

Used to determine if RadDateRangePicker is empty.

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

true if the date is empty; otherwise false.

Gets or sets a value indicating where RadDateRangePicker will look for its .resx localization file. By default this file should be in the App_GlobalResources folder. However, if you cannot put the resource file in the default location or .resx files compilation is disabled for some reason (e.g. in a DotNetNuke environment), this property should be set to the location of the resource file.

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

A relative path to the dialogs location. For example: "~/controls/RadDateRangePickerResources/".

If specified, the LocalizationPath property will allow you to load the grid localization file from any location in the web application.

Gets or sets the latest valid date for selection. Selecting a date later than that will not be allowed.

C#
[ClientControlProperty]
public DateTime MaxDate { get; set; }

This property has a default value of 12/31/2099

Gets or sets the minimal range date for selection. Selecting a date earlier than that will not be allowed.

C#
[ClientControlProperty]
public DateTime MinDate { get; set; }

This property has a default value of 1/1/1980

Gets or sets a value indicating whether the picker will create an overlay element to ensure popups are over a flash element or Java applet.

C#
[Browsable(true)]
[Bindable(true)]
public bool Overlay { get; set; }
Property Value:

The default value is false.

Gets or sets the direction in which the popup Calendar is displayed, with relation to the DatePicker control.

C#
[ClientControlProperty]
[ClientPropertyName("_popupDirection")]
public DatePickerPopupDirection PopupDirection { get; set; }

Gets or sets the date content of RadDateRangePicker.

C#
public virtual DateTime? RangeSelectionEndDate { get; set; }
Property Value:

A DateTime object that represents the selected date. The default value is MinDate.

Example:
cs-api-definition
private void Page_Load(object sender, System.EventArgs e)
{
RadDateRangePicker1.SelectedDate = DateTime.Now;
}

Gets or sets the date content of RadDateRangePicker.

C#
public virtual DateTime? RangeSelectionStartDate { get; set; }
Property Value:

A DateTime object that represents the selected date. The default value is MinDate.

Example:
cs-api-definition
private void Page_Load(object sender, System.EventArgs e)
{
RadDateRangePicker1.SelectedDate = DateTime.Now;
}

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

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

Overrides: RadWebControl.RegisterWithScriptManager

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

Sets the render mode of the RadDateRangePicker and its child controls

C#
public override RenderMode RenderMode { get; set; }

Overrides: RadWebControl.RenderMode

Gets or sets the reference to the calendar that will be used for picking dates. This property allows you to configure several datepickers to use a single RadCalendar instance.

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

The RadCalendar 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 calendar instance is in another naming container or is created dynamically at runtime.

Gets or sets the ID of the calendar that will be used for picking dates. This property allows you to configure several datepickers to use a single RadCalendar instance.

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

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

RadDateRangePicker will look for the RadCalendar 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 calendar that is inside a control in another naming container. You can still share a calendar, but you will have to pass a direct object reference via the SharedCalendar property.

C#
protected virtual bool ShouldRenderAdditionalControls { get; }

Gets or sets whether the popup Calendar control is displayed when the DateInput textbox is focused.

C#
[ClientControlProperty]
[ClientPropertyName("_showPopupOnFocus")]
public bool ShowPopupOnFocus { get; set; }
Property Value:

The default value is false.

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: RadWebControl.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 or sets if the server-side min/max date validation.

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

Determines if the server-side min/max date validation.

Gets the start RadDatePicker instance of the daterangepicker control.

C#
[Browsable(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual RadDatePicker StartDatePicker { get; }
C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadWebControl.SupportsRenderingMode

C#
protected override HtmlTextWriterTag TagKey { get; }

Overrides: WebControl.TagKey

Gets or sets the width of the datepicker in pixels.

C#
public override Unit Width { get; set; }

Overrides: RadWebControl.Width

Gets or sets the caption for the table which wraps the RadDateRangePicker controls.

C#
public virtual string WrapperTableCaption { get; set; }
Property Value:

The default value is "RadDateRangePicker".

Setting this property to empty string will force Telerik RadDateRangePicker to not render caption tag.

Gets or sets summary attribute for the table which wraps the RadDateRangePicker controls.

C#
public virtual string WrapperTableSummary { get; set; }
Property Value:

The default value is "Table holding date picker control for selection of dates.".

Setting this property to empty string will force Telerik RadDateRangePicker to not render summary tag.

Gets or sets the z-index style of the control's popups

C#
[ClientControlProperty]
[ClientPropertyName("_zIndex")]
public int ZIndex { get; set; }

Methods

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

Clears the selected date of the RadDateRangePicker control and displays a blank date.

C#
public virtual void Clear()

Override this method to provide any last minute configuration changes. Make sure you call the base implementation.

C#
public virtual void ConfigureDateInput()
C#
protected override void CreateChildControls()

Overrides: Control.CreateChildControls()

C#
protected virtual void CreateTimeControls()
C#
protected override void DescribeComponent(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadWebControl.DescribeComponent(IScriptDescriptor)

C#
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected virtual void DescribeProperties(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Sets input focus to a control.

C#
public override void Focus()

Overrides: Control.Focus()

C#
protected virtual bool isOnlyInputRendered()
Returns:

bool

Loads the client state data

C#
protected override void LoadClientState(Dictionary<string, object> clientState)
Parameters:clientStateDictionary<string, object>

Overrides: RadWebControl.LoadClientState(Dictionary<string, object>)

C#
protected virtual void OnChildrenCreated()
C#
protected override void OnInit(EventArgs e)
Parameters:eEventArgs

Overrides: RadWebControl.OnInit(EventArgs)

C#
protected virtual void OnRangeSelectionChanged(RangeSelectionChangedEventArgs eventArgs)
Parameters:eventArgsRangeSelectionChangedEventArgs
C#
protected virtual DateTime? RangeSelectedDateProperty(DateTime? value)
Parameters:valueDateTime?Returns:

DateTime?

Registers the CSS references

C#
protected override void RegisterCssReferences()

Overrides: RadWebControl.RegisterCssReferences()

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

Overrides: Control.RenderChildren(HtmlTextWriter)

C#
protected virtual void SetDefaultSize()
C#
protected virtual void SetRenderMode(RenderMode mode)
Parameters:modeRenderMode
C#
protected virtual DateTime TruncateTimeComponent(DateTime value)
Parameters:valueDateTimeReturns:

DateTime

Events

Occurs after all child controls of the DatePicker control have been created. You can customize the control there, and add additional child controls.

C#
public event EventHandler ChildrenCreated

Occurs when the selected range of the DateRangePicker changes between posts to the server.

C#
public event RangeSelectionChangedEventHandler RangeSelectionChanged