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

GridDropDownColumn with treeview

2 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Safa Amini
Top achievements
Rank 1
Safa Amini asked on 02 May 2010, 05:52 AM
I am working with GridDropDownColumn and I need to show a treeview inside the combobox or at least be able to add some icons to each entry. I know that a good way would be to use a template column and handle everything  manually, and that is what I am trying to avoid, because it's so easy to use a dropdownColumn and rest assured that db operations as well as grouping and sorting would be taken care of automatically.

I have tried the following code:
    Private Sub grdOrderable_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdOrderable.ItemDataBound  
  
        If e.Item.IsInEditMode And TypeOf (e.Item) Is GridEditableItem Then  
            Dim item As GridEditableItem = e.Item  
  
            Dim catEditor As GridDropDownListColumnEditor = item.EditManager.GetColumnEditor("OrderableCatCode")  
            For Each i As RadComboBoxItem In catEditor.ComboBoxControl.Items  
                i.ImageUrl = GetCatIcon(i.Value)''query the db to get the type and choose an icon  
                i.Text = GetCatStartString(i.Value) & i.Text''insert some '-' characters  
            Next  
  
        End If  
    End Sub  

and the result can be seen in the attached picture and it does not look very elegant. (because it is not a treeview)
Should I go for the template column solution or do you suggest a better one?

Thank you very much.
Safa

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 06 May 2010, 08:15 AM
Hello Safa,

I followed your scenario and prepared a simple runnable application that demonstrates the needed functionality. Please examine it and let me know if it works as expected or if I am leaving something important out.

I hope this gets you started properly.

Best wishes,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Safa Amini
Top achievements
Rank 1
answered on 06 May 2010, 09:17 PM
Hi Pavlina
Thanks for the detailed code.
I reviewed the source you had developed (though I could not run it because of the db version problem, (mine is 2005), but I could understand it nonetheless.) and I can see that you have used the template solution (which seems to be the only solution). I am a big fan of templates myself, but since GridDropdownColumn is so easy to use, one tends to avoid a template as much as possible. (using a template is like turning the auto-pilot off: you have to do everything yourself!)

Thanks again,
Safa

Tags
Grid
Asked by
Safa Amini
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Safa Amini
Top achievements
Rank 1
Share this question
or