I am dynamically generating a list of columns for a radgrid and everything there is fine the issue that occurs when I'm trying to convert a GridBoundcColumn to a GridDropDownListColumnEditor on the CreateColumnEditor
I was wondering if it was possible to add to add a drop down list, combo box or even a lookup button to the edit template on the radgrid
*Note the datatable is just for testing the columns are coming from a database
I was wondering if it was possible to add to add a drop down list, combo box or even a lookup button to the edit template on the radgrid
*Note the datatable is just for testing the columns are coming from a database
Public Property DT As DataTable Get Return ViewState("DT") End Get Set(ByVal value As DataTable) ViewState("DT") = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then AddEditColumn() DT = GetData() End If End Sub Private Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource Me.RadGrid1.DataSource = DT End Sub Sub AddEditColumn() If Not RadGrid1.Columns.Contains("GridEditCommandColumn") Then Dim EditCol As New GridEditCommandColumn RadGrid1.Columns.Add(EditCol) End If End Sub Private Sub RadGrid1_CreateColumnEditor(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCreateColumnEditorEventArgs) Handles RadGrid1.CreateColumnEditor If (TypeOf e.Column Is GridBoundColumn) Then If (CType(e.Column, GridBoundColumn).DataField = "Customer") Then e.ColumnEditor = New GridTextBoxColumnEditor 'e.ColumnEditor.ContainerControl.Controls ElseIf (CType(e.Column, GridBoundColumn).DataField = "CustomerType") Then 'e.ColumnEditor = New GridDropDownListColumnEditor End If End If End Sub Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated If (TypeOf e.Item Is GridDataItem) Then Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) ElseIf (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) End If End Sub Private Function GetData() Dim datatable As New DataTable datatable.Columns.Add("Customer", GetType(String)) datatable.Columns.Add("CustomerType", GetType(String)) '******************************************************** 'CustomerType is the Column that needs to be a drop down.
'******************************************************** datatable.Columns.Add("QtyOrd", GetType(Integer)) datatable.Columns.Add("Date1", GetType(Date)) datatable.Columns.Add("Date2", GetType(Date)) datatable.Columns.Add("OnTime", GetType(Boolean)) datatable.Rows.Add({("A&A Beef"), ("WHOL"), 1, DateTime.Now, DateTime.Now, False}) datatable.Rows.Add({("Vegmart"), ("RET"), 8, DateTime.Now, DateTime.Now, False}) Return datatable End Function