Hi Team.
I was able to create custom radcheckeddrowdownlistelement in radgridview, but can figure out how to bind datasource when adding rows since each row with the custom radcheckeddropdownlistelement will different datasouce bind to it. Below is my code:
// Custom checkbox list
Public Class CheckBoxListCellElement
Inherits GridDataCellElement
Public Sub New(ByVal column As GridViewColumn, ByVal row As GridRowElement)
MyBase.New(column, row)
End Sub
Private checkBoxListElement As RadCheckedDropDownListElement
Protected Overrides Sub CreateChildElements()
MyBase.CreateChildElements()
checkBoxListElement = New RadCheckedDropDownListElement
Me.Children.Add(checkBoxListElement)
End Sub
Protected Overrides Sub SetContentCore(value As Object)
If Me.Value IsNot Nothing AndAlso Me.Value IsNot DBNull.Value Then
Me.checkBoxListElement.Text = Convert.ToString(value)
End If
End Sub
Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
Get
Return GetType(GridDataCellElement)
End Get
End Property
Public Overrides Function IsCompatible(data As GridViewColumn, context As Object) As Boolean
Return TypeOf data Is CheckBoxListColumn AndAlso TypeOf context Is GridDataRowElement
End Function
End Class
Public Class CheckBoxListColumn
Inherits GridViewDataColumn
Public Sub New(ByVal fieldName As String)
MyBase.New(fieldName)
End Sub
Public Overrides Function GetCellType(row As GridViewRowInfo) As Type
If TypeOf row Is GridViewDataRowInfo Then
Return GetType(CheckBoxListCellElement)
End If
Return MyBase.GetCellType(row)
End Function
End Class
// main form load event with the gridview
Private Sub QuestionaireForm_Load(sender As Object, e As EventArgs) Handles Me.Load
RadGridView1.Rows.Add(data1 to bind to customradcheckboxlist )
RadGridView1.Rows.Add(data1 to bind to customradcheckboxlist )
End Sub
However, I have seen the article on radgridview editor required for the radcheckeddropdownlist. But want the above code to work.
Thanks in advance.