This is a migrated thread and some comments may be shown as answers.

I Want Custom Cell In Gridview

2 Answers 37 Views
This is a migrated thread and some comments may be shown as answers.
Shanti 😎 asked on 05 Feb 2020, 06:46 AM


I Want custom cell in RadGridview. For enter data and also arrow button to view popup like Figure 1.

I am looking forward to your reply.


2 Answers, 1 is accepted

Sort by
answered on 06 Feb 2020, 07:30 AM


I implemented this popup. Can you give me a better option?

Private Sub grdProduct_EditorRequired(sender As Object, e As EditorRequiredEventArgs) Handles grdProduct.EditorRequired
        If e.EditorType = GetType(RadTextBoxEditor) AndAlso grdProduct.CurrentColumn.Name = "Description" Then
            e.EditorType = GetType(MyEditor)
        End If
End Sub

Public Class MyEditor
    Inherits RadTextBoxEditor

    Protected Overrides Function CreateEditorElement() As Telerik.WinControls.RadElement
        Return New MyTextElement()
    End Function

    Public Overrides Sub BeginEdit()
        Dim oldValue As String = Me.Value.ToString()
        Me.EditorElement.Tag = oldValue
    End Sub
End Class

Public Class MyTextElement
    Inherits RadTextBoxEditorElement

    Public Sub New()
        Dim button As RadButtonElement = New RadButtonElement()
        AddHandler button.Click, AddressOf button_Click

        button.Padding = New Padding(2, 0, 2, -2)
        button.Margin = New Padding(0, 0, 0, 0)
        button.Text = "▼"

        Dim tbItem As RadTextBoxItem = Me.TextBoxItem

        Dim dockPanel As DockLayoutPanel = New DockLayoutPanel()

        DockLayoutPanel.SetDock(tbItem, Dock.Left)
        DockLayoutPanel.SetDock(button, Dock.Right)

    End Sub

    Private Sub button_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim rtxtboxitem As RadTextBoxItem = CType(sender, RadButtonElement).Parent.Children(1)

        Dim frm As New frmDescription
        frm.txtDescription.Text = rtxtboxitem.Text
        frm.Location = frmInvoice.grdProduct.CurrentCell.PointToScreen(frmInvoice.grdProduct.CurrentCell.Location)
        If frm.ShowDialog = DialogResult.OK Then
            rtxtboxitem.Text = frm.txtDescription.Text
        End If
    End Sub

End Class

Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Feb 2020, 09:56 AM
Hello, Shanti,   

I have changed the product of this support ticket to RadGridView, since it was specified as RadMenu. The provided screenshot is greatly appreciated for understanding better your requirement for an editor in RadGridView

Following the provided code snippet, I was able to build a runnable project and successfully embedded the custom editor in the grid. It seems to work as expected on my end.

I would recommend you to have a look at the following KB articles which demonstrate two approaches which may be suitable for your case: 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 


Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question