We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DropDownGridCell in GridDataBoundGrid

I would like to use a pushbutton rather than the default dropdown button to drop down the grid. I am using the following code to create my DropDownGridCell mports System Imports System.Collections Imports System.ComponentModel Imports System.Diagnostics Imports System.Drawing Imports System.Windows.Forms Imports System.Text Imports System.Runtime.Serialization Imports Syncfusion.Diagnostics Imports Syncfusion.Windows.Forms Imports Syncfusion.Windows.Forms.Grid ''/ ''/ Summary description for DropDownGridCell. ''/ Public Class DropDownGridCellModel Inherits GridDropDownGridCellModel Private _embbeddedGrid As GridControlBase Public Property EmbeddedGrid() As GridControlBase Get If _embbeddedGrid Is Nothing Then _embbeddedGrid = New GridControlBaseImp() End If Return _embbeddedGrid End Get Set _embbeddedGrid = value End Set End Property Protected Sub New(info As SerializationInfo, context As StreamingContext) MyBase.New(info, context) End Sub ''New Public Sub New(grid As GridModel) MyBase.New(grid) End Sub ''New Public Overrides Function CreateRenderer(control As GridControlBase) As GridCellRendererBase Return New DropDownGridCellRenderer(control, Me) End Function ''CreateRenderer End Class ''DropDownGridCellModel Public Class DropDownGridCellRenderer Inherits GridDropDownGridCellRenderer Private _grid As GridControlBase Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase) MyBase.New(grid, cellModel) Me.DisableTextBox = True Me.ControlText = "More..." DropDownButton = New GridCellButton(Me) Me._grid = Nothing End Sub ''New Protected Overrides Sub OnInitialize(ByVal rowIndex As Integer, ByVal colIndex As Integer) Me._grid = CType(Me.Model, DropDownGridCellModel).EmbeddedGrid Me._grid.Dock = DockStyle.Fill MyBase.OnInitialize(rowIndex, colIndex) End Sub ''OnInitialize Protected Overrides Sub InitializeDropDownContainer() MyBase.InitializeDropDownContainer() ''this.DropDownContainer.FormBorderStyle = FormBorderStyle.SizableToolWindow; Me.DropDownContainer.IgnoreDialogKey = True End Sub ''InitializeDropDownContainer Protected Overrides Function CreateInnerControl(ByRef grid As GridControlBase) As Control grid = Me._grid grid.Dock = DockStyle.Fill grid.CausesValidation = False Return grid End Function ''CreateInnerControl End Class ''DropDownGridCellRenderer Thanks in advance for any help.

1 Reply

AD Administrator Syncfusion Team December 14, 2004 08:32 PM UTC

What is not working for you? I was able to display a pushbutton in the grid\Sample\In Depth\DropdownGrid sample by changing the button in the Renderer constructor the same as you. If you wantto set More... as the text, you need to set the button.Text property.
Public Sub New(grid As GridControlBase, cellModel As GridCellModelBase)
      MyBase.New(grid, cellModel)
      Me.DisableTextBox = True
      DropDownButton = New GridCellButton(Me)
      DropDownButton.Text = "More..."
      Me._grid = Nothing
End Sub ''New
If you want to enlarge the button, you set the ButtonBar size in the CellModel constructor.
Public Sub New(grid As GridModel)
        ButtonBarSize = New Size(60, 20)
End Sub ''New

Live Chat Icon For mobile
Up arrow icon