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

This Class defines the RadDropDownList.

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

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("DropDownList", typeof(RadDropDownList))]
[EmbeddedSkin("DropDownList", "Default", typeof(RadDropDownList))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadDropDownList))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[RequiredScript(typeof(jQueryPlugins), 1)]
[RequiredScript(typeof(DropDown), 2)]
[RequiredScript(typeof(TouchScrollExtender), 3)]
[RequiredScript(typeof(MaterialRipple))]
[ClientScriptResource("Telerik.Web.UI.RadDropDownList", "Telerik.Web.UI.DropDownList.RadDropDownListScripts.js")]
[ValidationProperty("SelectedText")]
[ControlValueProperty("SelectedValue")]
[TelerikToolboxCategory("Data Editing")]
[ToolboxBitmap(typeof(RadDropDownList), "Toolbox.Icons.DropDownList.png")]
public class RadDropDownList : ControlItemContainer, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, INamingContainer, IXmlSerializable, IControlItemContainer, ICallbackEventHandler, IPostBackEventHandler, IFlatBoundContainer

Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlControlItemContainerRadDropDownList...

Implements: IAttributeAccessorICallbackEventHandlerIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlItemContainerIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupIFlatBoundContainerINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIScriptControlISkinnableControlIUrlResolutionServiceIXmlSerializable...

Inherited Members ControlItemContainer.PrepareForDataBinding()ControlItemContainer.GetXml()ControlItemContainer.LoadXml(string)ControlItemContainer.CreateItem(ClientStateLogEntry)ControlItemContainer.FindChild<TControlItem>(Predicate<TControlItem>)ControlItemContainer.GetAllChildren<TControlItem>()ControlItemContainer.FindChildByValue<TControlItem>(string)ControlItemContainer.FindChildByValue<TControlItem>(string, bool)ControlItemContainer.FindChildByText<TControlItem>(string)ControlItemContainer.FindChildByText<TControlItem>(string, bool)ControlItemContainer.FindChildByAttribute<TControlItem>(string, string)ControlItemContainer.InitializeItem(ControlItem)ControlItemContainer.ReadXml(XmlReader)ControlItemContainer.GetItemTypeFromXmlTagName(string)ControlItemContainer.ReadXmlForChildren(XmlReader)ControlItemContainer.WriteXml(XmlWriter)ControlItemContainer.WriteXmlForChildren(XmlWriter)ControlItemContainer.GetXml(XmlSerializer, TextWriter)ControlItemContainer.LoadXml(ControlItemContainer)ControlItemContainer.LoadViewState(object)ControlItemContainer.SaveViewState()ControlItemContainer.TrackViewState()ControlItemContainer.FindItemByHierarchicalIndex(string)ControlItemContainer.GetPostbackEventReference()ControlItemContainer.AppendDataBoundItemsControlItemContainer.DataTextFieldControlItemContainer.DataValueFieldControlItemContainer.DataTextFormatStringControlItemContainer.ValidationGroupControlItemContainer.PostBackUrlControlItemContainer.CausesValidationControlItemContainer.KeyboardNavigationSettingsControlItemContainer.TemplateControlItemContainer.ChildrenDataBoundControl.OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)DataBoundControl.CreateDataSourceSelectArguments()DataBoundControl.GetData()DataBoundControl.GetDataSource()DataBoundControl.MarkAsDataBound()DataBoundControl.OnDataPropertyChanged()DataBoundControl.OnDataSourceViewChanged(object, EventArgs)DataBoundControl.OnLoad(EventArgs)DataBoundControl.OnPagePreLoad(object, EventArgs)DataBoundControl.PerformSelect()DataBoundControl.ValidateDataSource(object)DataBoundControl.DataMemberDataBoundControl.IsUsingModelBindersDataBoundControl.ItemTypeDataBoundControl.SelectMethodDataBoundControl.DataSourceIDDataBoundControl.DataSourceObjectDataBoundControl.SelectArgumentsDataBoundControl.CreatingModelDataSourceDataBoundControl.CallingDataMethodsBaseDataBoundControl.ConfirmInitState()BaseDataBoundControl.DataBind()BaseDataBoundControl.EnsureDataBound()BaseDataBoundControl.OnDataBound(EventArgs)BaseDataBoundControl.OnInit(EventArgs)BaseDataBoundControl.OnPreRender(EventArgs)BaseDataBoundControl.DataSourceBaseDataBoundControl.InitializedBaseDataBoundControl.IsBoundUsingDataSourceIDBaseDataBoundControl.IsDataBindingAutomaticBaseDataBoundControl.SupportsDisabledAttributeBaseDataBoundControl.RequiresDataBindingBaseDataBoundControl.DataBoundWebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnabledWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.IsEnabledWebControl.SkinIDWebControl.TabIndexWebControl.TagNameWebControl.ToolTipWebControl.WidthControl.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(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)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.CreateChildControls()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.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 RadDropDownList()

Properties

Gets the object that controls the Wai-Aria settings applied on the control's element.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WaiAriaSettings AriaSettings { get; }

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

C#
[Bindable(false)]
[ClientControlProperty]
public bool AutoPostBack { get; set; }

Set this property to true if the server needs to capture the selection as soon as it is made. For example, other controls on the Web page can be automatically filled depending on the user's selection from a list control.

This property can be used to allow automatic population of other controls on the Web page based on a user's selection from a list.

The value of this property is stored in view state.

Gets a list of all client-side changes (adding an Item, removing an Item, changing an Item's property) which have occurred.

C#
[Browsable(false)]
public IList<ClientOperation<DropDownListItem>> ClientChanges { get; }

Gets or sets the HTML template of a DropDownListItem when added on the client.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public string ClientItemTemplate { get; set; }

Gets the settings for the animation played when the dropdown closes.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings CollapseAnimation { get; }
Property Value:

An AnimationSettings that represents the collapse animation.

Use the CollapseAnimation property to customize the expand animation of RadDropDownList. You can specify the Type and Duration. To disable collapse animation effects you should set the Type to AnimationType.None.
To customize the expand animation you can use the ExpandAnimation property.

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadDropDownList1.CollapseAnimation.Type = AnimationType.Linear;
RadDropDownList1.CollapseAnimation.Duration = 300;
}

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

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

Gets or sets a message when there is no selected item in the DropDownList.

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

The message which will be shown when there is no selected item.

Gets or sets whether to enable/disable the RadDropDownList drop down auto width.

C#
[Bindable(true)]
[ClientControlProperty]
[ClientPropertyName("_dropDownAutoWidth")]
public RadDropDownListDropDownAutoWidth DropDownAutoWidth { get; set; }

Gets or sets the height of the dropdown in pixels.

C#
[ClientControlProperty]
public Unit DropDownHeight { get; set; }

Gets or sets the width of the dropdown in pixels.

C#
[ClientControlProperty]
public Unit DropDownWidth { get; set; }

When set to true enables support for WAI-ARIA

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

Determines whether the Direction Detection is enabled or not.

C#
[Bindable(false)]
[ClientControlProperty]
[ClientPropertyName("_enableDirectionDetection")]
public bool EnableDirectionDetection { get; set; }

Determines whether the Screen Boundaries Detection is enabled or not.

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

Gets or sets a value indicating whether the functionality to render and load items on demand is enabled or not.

C#
[Bindable(false)]
[ClientControlProperty]
public bool EnableVirtualScrolling { get; set; }

When set to true upon scroll a request will be made either to the server or to a web service in order to render and initialize a new set of items

Gets the settings for the animation played when the dropdown opens.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings ExpandAnimation { get; }
Property Value:

An AnimationSettings that represents the expand animation.

Use the ExpandAnimation property to customize the expand animation of RadDropDownList. You can specify the Type and Duration. To disable expand animation effects you should set the Type to AnimationType.None.
To customize the collapse animation you can use the CollapseAnimation property.

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadDropDownList1.ExpandAnimation.Type = AnimationType.Linear;
RadDropDownList1.ExpandAnimation.Duration = 300;
}

Gets or sets a value indicating the opening direction of RadDropDownList dropdown. If this property is not set - by default dropdown opens downwards.

C#
[ClientControlProperty]
[ClientPropertyName("expandDirection")]
public DropDownListExpandDirection ExpandDirection { get; set; }

Gets or sets the height of the Web server control.

C#
public override Unit Height { get; }
Property Value:

A Unit that represents the height of the control. The default is Empty.

Overrides: RadDataBoundControl.Height

Gets or sets the number of Items the RadDropDownList will load when the VirtualScolling functionality is enabled.

C#
[Bindable(false)]
[ClientControlProperty]
public int ItemCountPerRequest { get; set; }

When this property is not set the number Items which will be loaded will be calculated based on the height of the DropDrown of the RadDropDownList and the height of a single item.

Gets the items of the RadDropDownList control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public DropDownListItemCollection Items { get; }
Property Value:

The DropDownListItemCollection object which represents the items.

You can use the Items property to add and remove items in the RadDropDownList control.

Gets or sets the ITemplate that defines how items in the RadDropDownList control are displayed.

C#
[TemplateContainer(typeof(DropDownListItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public virtual ITemplate ItemTemplate { get; set; }
Property Value:

The item template.

The ID of the RadAjaxLoadingPanel to be displayed during Callback or WebService calls

C#
[PersistenceMode(PersistenceMode.Attribute)]
[TypeConverter("Telerik.Web.Design.AjaxLoadingPanelIDConverter, Telerik.Web.Design, Version=2026.3.812.462, Culture=neutral, PublicKeyToken=121fae78165ba3d4")]
[ClientPropertyName("_loadingPanelID")]
[ClientControlProperty]
public string LoadingPanelID { get; set; }

The client-side event that is fired after the dropdown of the dropdownlist is closed.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("dropDownClosed")]
public string OnClientDropDownClosed { get; set; }

The event handler receives two parameter: the instance of the dropdownlist client-side object and event args. The event can not be cancelled

Example:
C#
&lt;script language="javascript"&gt;

function HandleClose(sender, args)
{
alert("Closed dropdown");

}

&lt;/script&gt;


&lt;telerik:RadDropDownList
id="RadDropDownList1"
Runat="server"
OnClientDropDownClosed="HandleClose"&gt;
&lt;/telerik:RadDropDownList&gt;

The client-side event that is fired before the dropdown of the dropdownlist is closed.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("dropDownClosing")]
public string OnClientDropDownClosing { get; set; }

The event handler receives two parameter: the instance of the dropdownlist client-side object and event args. The event can be cancelled - simply set args.set_cancel to true args.set_cancel(true); from the event handler and the dropdownlist dropdown will not be closed.

Example:
C#
&lt;script language="javascript"&gt;

function HandleClose(sender, args)
{
if (someCondition)
{
args.set_cancel(true);
}
else
{
alert("Closing dropdown");
}
}

&lt;/script&gt;


&lt;telerik:RadDropDownList
id="RadDropDownList1"
Runat="server"
OnClientDropDownClosing="HandleClose"&gt;
&lt;/telerik:RadDropDownList&gt;

The client-side event that is fired after the dropdown of the dropdownlist is opened.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("dropDownOpened")]
public string OnClientDropDownOpened { get; set; }

The event handler receives two parameter: the instance of the dropdownlist client-side object and event args. The event cannot be cancelled.

Example:
C#
&lt;script language="javascript"&gt;

function HandleOpen(sender,args)
{
alert("Opening combobox with " + comboBox.get_items().get_count() + " items");

}

&lt;/script&gt;


&lt;telerik:RadDropDownList
id="RadDropDownList1"
Runat="server"
OnClientDropDownOpened="HandleOpen"&gt;
&lt;/telerik:RadDropDownList&gt;

The client-side event that is fired before the dropdown of the DropDownList is opened.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("dropDownOpening")]
public string OnClientDropDownOpening { get; set; }

The event handler receives two parameter: the instance of the dropdownlist client-side object and event args. The event can be cancelled - simply set args.set_cancel to true args.set_cancel(true); from the event handler and the dropdownlist dropdown will not be opened.

Example:
C#
&lt;script language="javascript"&gt;

function HandleOpen(sender,args)
{
if (someCondition)
{
args.set_cancel(true);
}
else
{
alert("Opening dropDown");
}
}

&lt;/script&gt;


&lt;telerik:RadDropDownList
id="RadDropDownList1"
Runat="server"
OnClientDropDownOpening="HandleOpen"&gt;
&lt;/telerik:RadDropDownList&gt;

Gets or sets the name of the JavaScript function called when an Item is created during Web Service Binding mode.

C#
[ClientControlEvent]
[ClientPropertyName("itemDataBound")]
public string OnClientItemDataBound { get; set; }

The event handler receives two parameters: the instance of of the dropdownlist client-side object and event argument with get_dateItem() and get_item() methods.

Example:
C#
&lt;script language="javascript"&gt;
function OnClientItemDataBound(sender, eventArgs)
{
var dataItem = eventArgs.get_dateItem();
var item = eventArgs.get_item();
}
&lt;/script&gt;

&lt;telerik:RadDropDownList ID="RadDropDownList1" runat="server"
OnClientItemDataBound="onClientTemplateDataBound"&gt;
&lt;WebServiceSettings Method="GetItems" Path="DropDownWCFService.svc" /&gt;
&lt;/telerik:RadDropDownList&gt;

The client-side event that is fired when a dropDownListItem is selected.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemSelected")]
public string OnClientItemSelected { get; set; }

The event handler receives two parameters: the instance of of the dropdownlist client-side object and event argument with the item which is selected.

Example:
C#
&lt;script language="javascript"&gt;
function onClientItemSelected(sender,eventArgs)
{
alert("Item " + eventArgs.get_item().get_text() + " is selected.");
}
&lt;/script&gt;

&lt;telerik:RadDropDownList ID="RadDropDownList1" runat="server"
OnClientItemSelected="onClientItemSelected"&gt;
&lt;/telerik:RadDropDownList&gt;

The client-side event that is fired when a dropDownListItem is about to be selected.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemSelecting")]
public string OnClientItemSelecting { get; set; }

The event handler receives two parameters: the instance of of the dropdownlist client-side object and event argument with the item which is about to be selected and set_cancel method.The event can be cancelled.

Example:
C#
&lt;script language="javascript"&gt;
function onClientItemSelecting(sender,eventArgs)
{
if (someCondition)
{
eventArgs.set_cancel(true);
}
else
{
alert("Item " + eventArgs.get_item().get_text() + " will be selected.");
}
}
&lt;/script&gt;

&lt;telerik:RadDropDownList ID="RadDropDownList1" runat="server"
OnClientItemSelecting="onClientItemSelecting"&gt;
&lt;/telerik:RadDropDownList&gt;

Gets or sets a value indicating the client-side event handler that is called when the RadDropDownList items were just populated (for example from web service).

C#
[ClientControlEvent]
[ClientPropertyName("itemsRequested")]
public string OnClientItemsRequested { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientItemsRequested client-side event handler is called when the RadDropDownList items were just populated. Two parameters are passed to the handler:

  • sender, the menu client object;
  • eventArgs, null for this event.

This event cannot be cancelled.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onItemsRequested(sender, eventArgs)<br />
{<br />
       alert("Loading finished");<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadDropDownList ID="RadDropDownList1"<br />
runat="server"<br />
    <strong>OnClientItemsRequested="onItemsRequested"</strong>&gt;<br />
....<br />
&lt;/telerik:RadDropDownList&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when the operation for populating the RadDropDownList has failed.

C#
[ClientControlEvent]
[ClientPropertyName("itemsRequestFailed")]
public string OnClientItemsRequestFailed { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientItemsRequestFailed client-side event handler is called when the operation for populating the RadDropDownList has failed. Two parameters are passed to the handler:

  • sender, the menu client object;
  • eventArgs with one property:
    • set_cancel(), set to true to suppress the default action (alert message).

This event can be cancelled.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onItemsRequestFailed(sender, eventArgs)<br />
{<br />
       alert("Error: " + errorMessage);<br />
       eventArgs.set_cancel(true);<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadDropDownList ID="RadDropDownList1"<br />
runat="server"<br />
    <strong>OnClientItemsRequestFailed="onItemsRequestFailed"</strong>&gt;<br />
....<br />
&lt;/telerik:RadDropDownList&gt;</p>

Gets or sets a value indicating the client-side event handler that is called when the RadDropDownList is about to send a request for items (for example from web service).

C#
[ClientControlEvent]
[ClientPropertyName("itemsRequesting")]
public string OnClientItemsRequesting { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientItemsRequesting client-side event handler is called when the RadDropDownList is about to send a request for items. Two parameters are passed to the handler:

  • sender, the dropdownlist client object;
  • eventArgs with two properties:
    • get_context(), an user object that will be passed to the web service.
    • set_cancel(), used to cancel the event.

This event can be cancelled.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onItemRequestingHandler(sender, eventArgs)<br />
{<br />
       var context = eventArgs.get_context();<br />
       context["Parameter1"] = "Value";<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadDropDownList ID="RadDropDownList1"<br />
runat="server"<br />
    <strong>OnClientItemsRequesting="onItemRequestingHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadDropDownList&gt;</p>

Gets or sets a value indicating the client-side event handler that is called after the RadDropDownList client-side object is initialized.

C#
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClienLoad client-side event handler is called after the dropdownlist is fully initialized on the client.

A single parameter - the dropdownlist client object - is passed to the handler.

This event cannot be cancelled.

Example:
C#
<p>&lt;script type="text/javascript"&gt;<br />
function onClientLoadHandler(sender)<br />
{<br />
       alert(sender.get_id());<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;telerik:RadDropDownList ID="RadDropDownList1"<br />
runat= "server"<br />
    <strong>OnClientLoad="onClientLoadHandler"</strong>&gt;<br />
....<br />
&lt;/telerik:RadDropDownList&gt;</p>

The client-side event that is fired after the selected index of the RadDropDownList has been changed.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("selectedIndexChanged")]
public string OnClientSelectedIndexChanged { get; set; }

The event handler receives two parameters: the instance of of the dropdownlist client-side object and event argument with the new selected index.

Example:
C#
&lt;script language="javascript"&gt;
function onSelectedIndexChanged(sender,eventArgs)
{
var index = eventArgs.get_index();
// alert the index.
alert("The new selected index is : " + index);
}
&lt;/script&gt;

&lt;telerik:RadDropDownList ID="RadDropDownList1" runat="server"
OnClientSelectedIndexChanged="onSelectedIndexChanged"&gt;
&lt;/telerik:RadDropDownList&gt;

Gets or sets the name of the JavaScript function called when the client template for an item is evaluated

C#
[ClientControlEvent]
[ClientPropertyName("templateDataBound")]
public string OnClientTemplateDataBound { get; set; }

The event handler receives two parameters: the instance of of the dropdownlist client-side object and event argument with get_dateItem(), get_html(), set_html() and get_template() methods.

Example:
C#
&lt;script language="javascript"&gt;
function onClientTemplateDataBound(sender,eventArgs)
{
var html = eventArgs.get_html();
}
&lt;/script&gt;

&lt;telerik:RadDropDownList ID="RadDropDownList1" runat="server"
OnClientTemplateDataBound="onClientTemplateDataBound"&gt;
&lt;/telerik:RadDropDownList&gt;

Gets or sets the selected index of the RadDropDownList control.

C#
[Bindable(true)]
[Browsable(false)]
[ClientControlProperty]
[ClientPropertyName("_selectedIndex")]
public int SelectedIndex { get; set; }
Property Value:

The index that should be selected.

Set the selected index to -1 to clear the selection.

Gets the currently selected item in the dropdownlist.

C#
[Bindable(false)]
[Browsable(false)]
public virtual DropDownListItem SelectedItem { get; }

SelectedItem can be null in client-side binding scenarios.

Example:
cs-api-definition
&lt;telerik:RadDropDownList id="RadDropDownList1" Runat="server" &gt;&lt;/telerik:RadDropDownList&gt;

protected void Page_Load(object sender, EventArgs e)
{
var selectedItem = RadDropDownList1.SelectedItem;
}

Gets the text of the currently selected item in the dropdownlist.

C#
[Browsable(false)]
[Bindable(true, BindingDirection.TwoWay)]
[ClientControlProperty]
[ClientPropertyName("_selectedText")]
public virtual string SelectedText { get; set; }
Property Value:

The Text of the item which should be selected.

Example:
cs-api-definition
&lt;telerik:RadDropDownList id="RadDropDownList1" Runat="server" &gt;&lt;/telerik:RadDropDownList&gt;

protected void Page_Load(object sender, EventArgs e)
{
RadDropDownList1.SelectedText = "Item5";
}

Gets the value of the currently selected item in the dropdownlist.

C#
[Browsable(false)]
[Bindable(true, BindingDirection.TwoWay)]
[ClientControlProperty]
[ClientPropertyName("_selectedValue")]
public virtual string SelectedValue { get; set; }
Property Value:

The Value of the item which should be selected.

Example:
cs-api-definition
&lt;telerik:RadDropDownList id="RadDropDownList1" Runat="server" &gt;&lt;/telerik:RadDropDownList&gt;

protected void Page_Load(object sender, EventArgs e)
{
RadDropDownList1.SelectedValue = "5";
}
C#
public virtual string SmartPasteDescription { get; set; }
C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadDataBoundControl.SupportsRenderingMode

C#
protected override HtmlTextWriterTag TagKey { get; }

Overrides: ControlItemContainer.TagKey

Gets the unique, hierarchically qualified identifier for the server control.

C#
[ClientControlProperty]
[ClientPropertyName("_uniqueId")]
public override string UniqueID { get; }
Property Value:

The fully qualified identifier for the server control.

Overrides: Control.UniqueID

Gets the settings for the web service used to populate items.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WebServiceSettings WebServiceSettings { get; }
Property Value:

An WebServiceSettings that represents the web service used for populating items.

Use the WebServiceSettings property to configure the web service used to populate items on demand. You must specify both Path and Method to fully describe the service.

In order to use the integrated support, the web service should have the following signature:

   <pre><code class="lang-csharp">[ScriptService]

public class WebServiceName : WebService { private static int totalCount = 100; private static List<DropDownListItemData> itemsList = new List<DropDownListItemData>();

static DropDownService() { for (var i = 0; i < totalCount; i++) { DropDownListItemData itemData = new DropDownListItemData(); itemData.Text = "Item" + i.ToString(); itemData.Value = i.ToString(); itemData.Attributes["Attribute"] = "Attribute" + i.ToString(); itemsList.Add(itemData); } }

[WebMethod] public DropDownListData GetItems(DropDownListContext context) { DropDownListData data = new DropDownListData(); data.Items = itemsList.GetRange(context.StartIndex, context.ItemsCount).ToArray(); data.TotalCount = totalCount;

 return data;

} }

<System.Web.Script.Services.ScriptService()> _
Public Class WebService
Inherits System.Web.Services.WebService

   Private Shared totalCount As Integer = 100
   Private Shared itemsList As New List(Of DropDownListItemData)()

   Shared Sub New()
       For i As Integer = 0 To totalCount - 1
           Dim itemData As New DropDownListItemData()
           itemData.Text = "Item" + i.ToString()
           itemData.Value = i.ToString()
           itemData.Attributes("Attribute") = "Attribute" + i.ToString()
           itemsList.Add(itemData)

       Next
   End Sub

   <WebMethod> _
   Public Function GetItems(context As DropDownListContext) As DropDownListData
       Dim data As New DropDownListData()
       data.Items = itemsList.GetRange(context.StartIndex, context.ItemsCount).ToArray()
       data.TotalCount = totalCount

       Return data
   End Function

End Class

The HTML Z-index of the items dropdown of RadDropDownList.Its default value is 7000.

C#
[Bindable(false)]
public int ZIndex { get; set; }

Can be used when the dropdown is to be shown over content with a specified Z-index. If the dropdownlist items dropdown is displayed below the content, set the ZIndex property to a value higher than the value of the HTML content below.

Methods

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

Overrides: RadDataBoundControl.AddAttributesToRender(HtmlTextWriter)

Clears the selection. The Selected property of all items is set to false.

C#
public void ClearSelection()
C#
protected override ControlItemCollection CreateChildItemCollection()
Returns:

ControlItemCollection

Overrides: ControlItemContainer.CreateChildItemCollection()

This method should return object that implements IDropDownListRenderer or Inherits the

C#
protected override IRenderer CreateControlRenderer()
Returns:

IRenderer

Overrides: RadDataBoundControl.CreateControlRenderer()

C#
protected override ControlItem CreateItem()
Returns:

ControlItem

Overrides: ControlItemContainer.CreateItem()

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

Overrides: ControlItemContainer.DescribeComponent(IScriptDescriptor)

Finds the first DropDownListItem with Text that matches the given text value.

C#
public DropDownListItem FindItemByText(string text, bool ignoreCase)
Parameters:textstring

The string to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

DropDownListItem

The first DropDownListItem that matches the specified text value.

Example:
cs-api-definition
Dim item As DropDownListItem = RadDropDownList1.FindItemByText("New York",true)

Finds the first DropDownListItem with Text that matches the given text value.

C#
public DropDownListItem FindItemByText(string text)
Parameters:textstring

The string to search for.

Returns:

DropDownListItem

The first DropDownListItem that matches the specified text value.

Example:
cs-api-definition
Dim item As DropDownListItem = RadDropDownList1.FindItemByText("New York")

Finds the first DropDownListItem with Value that matches the given value.

C#
public DropDownListItem FindItemByValue(string value, bool ignoreCase)
Parameters:valuestring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

DropDownListItem

The first DropDownListItem that matches the specified value.

Example:
cs-api-definition
Dim item As DropDownListItem = RadDropDownList1.FindItemByValue("1", true)

Finds the first DropDownListItem with Value that matches the given value.

C#
public DropDownListItem FindItemByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

DropDownListItem

The first DropDownListItem that matches the specified value.

Example:
cs-api-definition
Dim item As DropDownListItem = RadDropDownList1.FindItemByValue("1")

Populates the RadDropDownList control from an XML file

C#
public void LoadContentFile(string xmlFileName)
Parameters:xmlFileNamestring

Name of the XML file.

Loads the posted content of the list control, if it is different from the last posting.

C#
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Parameters:postDataKeystring

The key identifier for the control, used to index the postCollection.

postCollectionNameValueCollection

A NameValueCollection that contains value information indexed by control identifiers.

Returns:

bool

true if the posted content is different from the last posting; otherwise, false.

Overrides: RadDataBoundControl.LoadPostData(string, NameValueCollection)

Raises the ItemCreated event.

C#
protected virtual void OnItemCreated(DropDownListItemEventArgs e)
Parameters:eDropDownListItemEventArgs

The DropDownListItemEventArgs instance containing the event data.

Raises the ItemDataBound event.

C#
protected void OnItemDataBound(DropDownListItemEventArgs e)
Parameters:eDropDownListItemEventArgs

The DropDownListItemEventArgs instance containing the event data.

Raises the ItemSelected event.

C#
protected void OnItemSelected(DropDownListEventArgs e)
Parameters:eDropDownListEventArgs

The DropDownListEventArgs instance containing the event data.

Raises the SelectedIndexChanged event.

C#
protected void OnSelectedIndexChanged(DropDownListEventArgs e)
Parameters:eDropDownListEventArgs

The DropDownListEventArgs instance containing the event data.

Raises the TemplateNeeded event.

C#
protected void OnTemplateNeeded(DropDownListItemEventArgs e)
Parameters:eDropDownListItemEventArgs

The DropDownListItemEventArgs instance containing the event data.

C#
protected override void PerformDataBinding(IEnumerable data)
Parameters:dataIEnumerable

Overrides: ControlItemContainer.PerformDataBinding(IEnumerable)

C#
protected override void RaiseItemCreated(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseItemCreated(ControlItem)

C#
protected override void RaiseItemDataBound(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseItemDataBound(ControlItem)

C#
protected virtual void RaisePostBackEvent(string eventArgument)
Parameters:eventArgumentstring
C#
protected override void RaiseTemplateNeeded(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemContainer.RaiseTemplateNeeded(ControlItem)

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

Overrides: RadDataBoundControl.RenderContents(HtmlTextWriter)

C#
protected virtual void TrackSelectedIndexChanged(DropDownListEventArgs e)
Parameters:eDropDownListEventArgs

Events

Occurs when item is created.

C#
public event DropDownListItemEventHandler ItemCreated

The ItemCreated event occurs before ItemDataBound and after postback if ViewState is enabled. ItemCreated is not raised for items defined inline in the ASPX.

Occurs when item is data bound.

C#
public event DropDownListItemEventHandler ItemDataBound

Use the ItemDataBound event to set additional properties of the databound items.

Example:
cs-api-definition
protected void RadDropDonwList1_ItemDataBound(object sender, DropDownListItemEventArgs e)
{
e.Item.ToolTip = (string)DataBinder.Eval(e.Item.DataItem, "ToolTipColumn");
}

Occurs when an item has been selected.

C#
public event DropDownListEventHandler ItemSelected

Occurs when the selected index has changed.

C#
public event DropDownListEventHandler SelectedIndexChanged

Occurs before template is being applied to the item.

C#
public event DropDownListItemEventHandler TemplateNeeded

The TemplateNeeded event is raised before a template is been applied on the item, both during round-trips (postbacks) and at the time data is bound to the control. The TemplateNeeded event is not raised for items which are defined inline in the page or user control.

The TemplateNeeded event is commonly used for dynamic templating.

Example:
cs-api-definition
protected void RadDropDownList1_TemplateNeeded(object sender, Telerik.Web.UI.DropDownListItemEventArgs e)
{
string value = e.Item.Value;
if (value != null)
{
// if the value is an even number
if ((Int32.Parse(value) % 2) == 0)
{
var textBoxTemplate = new TextBoxTemplate();
textBoxTemplate.InstantiateIn(e.Item);
}
}
}
In this article
DefinitionConstructorsRadDropDownList()PropertiesAriaSettingsAutoPostBackClientChangesClientItemTemplateCollapseAnimationCssClassFormatStringDefaultMessageDropDownAutoWidthDropDownHeightDropDownWidthEnableAriaSupportEnableDirectionDetectionEnableScreenBoundaryDetectionEnableVirtualScrollingExpandAnimationExpandDirectionHeightItemCountPerRequestItemsItemTemplateLoadingPanelIDOnClientDropDownClosedOnClientDropDownClosingOnClientDropDownOpenedOnClientDropDownOpeningOnClientItemDataBoundOnClientItemSelectedOnClientItemSelectingOnClientItemsRequestedOnClientItemsRequestFailedOnClientItemsRequestingOnClientLoadOnClientSelectedIndexChangedOnClientTemplateDataBoundSelectedIndexSelectedItemSelectedTextSelectedValueSmartPasteDescriptionSupportsRenderingModeTagKeyUniqueIDWebServiceSettingsZIndexMethodsAddAttributesToRender(HtmlTextWriter)ClearSelection()CreateChildItemCollection()CreateControlRenderer()CreateItem()DescribeComponent(IScriptDescriptor)FindItemByText(string, bool)FindItemByText(string)FindItemByValue(string, bool)FindItemByValue(string)LoadContentFile(string)LoadPostData(string, NameValueCollection)OnItemCreated(DropDownListItemEventArgs)OnItemDataBound(DropDownListItemEventArgs)OnItemSelected(DropDownListEventArgs)OnSelectedIndexChanged(DropDownListEventArgs)OnTemplateNeeded(DropDownListItemEventArgs)PerformDataBinding(IEnumerable)RaiseItemCreated(ControlItem)RaiseItemDataBound(ControlItem)RaisePostBackEvent(string)RaiseTemplateNeeded(ControlItem)RenderContents(HtmlTextWriter)TrackSelectedIndexChanged(DropDownListEventArgs)EventsItemCreatedItemDataBoundItemSelectedSelectedIndexChangedTemplateNeeded
Not finding the help you need?
Contact Support