Back to Devexpress

DropDownButton Class

aspnet-devexpress-dot-web-82f3a9e8.md

latest4.6 KB
Original Source

DropDownButton Class

Represents the default edit button that invokes the editor’s dropdown window.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class DropDownButton :
    EditButton
vb
Public Class DropDownButton
    Inherits EditButton

The following members return DropDownButton objects:

Remarks

The DropDownButton class contains settings of a button editor’s default edit button, a click on which invokes the editor’s dropdown window (which is the dropdown calendar for the ASPxDateEdit or dropdown list for the ASPxComboBox).

Example

This example demonstrates how to customize the collection of an editor’s edit buttons and how to change the DropDownButton position.

The default drop-down button’s position can be changed via the EditButton.Position property. Using this property, you can display the button at the left or at the right control side. To display the drop-down button at the custom position (between other edit buttons), hide the default button using the EditButton.Visible property. After that, you can create a custom drop-down button in the required place.

Note

To work properly, a control should have only one drop-down button: a default one or custom one (with a hidden default drop-down button).

The code sample below demonstrates how to create a custom EditButtonCollection within the ASPxDateEdit control. The image below shows the result.

aspx
<dx:ASPxDateEdit ID="ASPxDateEdit1" runat="server" Width="220px" ClientInstanceName="dateedit">
     <ClientSideEvents ButtonClick="onButtonClick" />
     <DropDownButton Visible="False">
     </DropDownButton>
     <Buttons>
          <dx:EditButton Text="Today" Position="Left" ToolTip="Today">
          </dx:EditButton>
          <dx:EditButton Position="Left" ToolTip="Previous day">
               <Image Url="~/Left.png">
               </Image>
          </dx:EditButton>
          <dx:EditButton ToolTip="Next day">
               <Image Url="~/Right.png">
               </Image>
          </dx:EditButton>
          <dx:DropDownButton ToolTip="Show calendar">
               <Image Url="~/Calendar.png">
               </Image>
          </dx:DropDownButton>
          <dx:EditButton ToolTip="Clear">
               <Image Url="~/Clear.png">
               </Image>
          </dx:EditButton>
     </Buttons>
</dx:ASPxDateEdit>
javascript
function onButtonClick (s, e) {
     var date = dateedit.GetDate();
     switch (e.buttonIndex) {
          case 0:
               var today = new Date();
               dateedit.SetDate(today);
               break;
          case 1:
               date.setDate(date.getDate() - 1);
               dateedit.SetDate(date);
               break;
          case 2: 
               date.setDate(date.getDate() + 1);
               dateedit.SetDate(date);
               break;
          case 4:
               dateedit.SetValue(null);
     };
}

Implements

IStateManager

IPropertiesOwner

IExpressionsAccessor

Inheritance

Object StateManager CollectionItem EditButton DropDownButton BootstrapDropDownButton

See Also

DropDownButton Members

Drop-Down Editor

DevExpress.Web Namespace