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()
MyBase.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
Me.Children.Remove(tbItem)
Dim dockPanel As DockLayoutPanel = New DockLayoutPanel()
dockPanel.Children.Add(button)
dockPanel.Children.Add(tbItem)
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
0
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 hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
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.