Hi,
I am using the Radfilter in my vb.net(2008) project.I am using the RadTreeview as the radcomboboxItem in the datafield editor.I mange to build the control dynamically.But when I add new rows for the filter,previously selected value is set to empty.
Please help on this issue..
                                I am using the Radfilter in my vb.net(2008) project.I am using the RadTreeview as the radcomboboxItem in the datafield editor.I mange to build the control dynamically.But when I add new rows for the filter,previously selected value is set to empty.
Please help on this issue..
Public Overrides Sub InitializeEditor(ByVal container As System.Web.UI.Control)         _combo = New RadComboBox()         _combo.ID = "MyCombo"         _combo.Width = 200         _combo.Height = 180             'For the Treeview         Dim treeItem As New ItemTemplateTreeView(CreateDataSource())         _combo.ItemTemplate = treeItem         Dim item As New RadComboBoxItem()         _combo.Items.Add(item)         _combo.OnClientDropDownOpened = "OnClientDropDownOpenedHandler"                container.Controls.Add(_combo)       End Sub     Public Overrides Function ExtractValues() As System.Collections.ArrayList         Dim list As ArrayList = New ArrayList()         list.Add(DirectCast(_combo.Items(0).FindControl("myTreeview"), RadTreeView).SelectedValue)         Return list     End Function   Public Overrides Sub SetEditorValues(ByVal values As System.Collections.ArrayList)                   If Not values Is Nothing And values.Count > 0 Then             If values(0) Is Nothing Then                 Return             End If             'Dim item As RadComboBoxItem = _combo.FindItemByValue(values(0).ToString())             Dim item As RadTreeNode = DirectCast(_combo.Items(0).FindControl("myTreeview"), RadTreeView).FindNodeByValue(values(0).ToString())             'If Not item Is Nothing Then                 item.Selected = True                 _combo.Items(0).Text = item.Text             '   _combo.Items(0).Value = item.Value             End If                      End If     End Sub   Protected Function CreateDataSource() As DataTable         Dim dataTable As New DataTable()         dataTable.Columns.Add(New DataColumn("Key", GetType(String)))         dataTable.Columns.Add(New DataColumn("Name", GetType(String)))         dataTable.Columns.Add(New DataColumn("ParentId", GetType(String)))           Dim AnalysItems As AnalysListItemList = TryCast(DataSource, AnalysListItemList )           For Each item As CategoryValueListItem In AnalysItems             Dim dr As DataRow = dataTable.NewRow()             dr("Key") = item.Key             dr("Name") = item.Name             If item.Category = item.Key Then                 dr("ParentId") = DBNull.Value             Else                 dr("ParentId") = item.Category            End If             dataTable.Rows.Add(dr)         Next         Return dataTable     End Function   Public Class ItemTemplateTreeView     Implements ITemplate       Private dataTable As DataTable     Public Sub New(ByVal _dataTable As DataTable)         '         ' TODO: Add constructor logic here         '         Me.dataTable = _dataTable     End Sub     Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn         Dim div As New HtmlGenericControl("div")         div.ID = "div1"         div.Attributes.Add("onclick", "StopPropagation(event);")           Dim tree As New RadTreeView()         Dim item As RadComboBoxItem = DirectCast(container, RadComboBoxItem)           tree.ID = "myTreeView"         tree.OnClientNodeClicking = "nodeClicking"         tree.DataTextField = "Name"         tree.DataFieldID = "Key"         tree.DataValueField = "Key"         tree.DataFieldParentID = "ParentId"         tree.DataSource = dataTable         tree.DataBind()           div.Controls.Add(tree)         container.Controls.Add(div)         End Sub   End Class
