I have a RadTreeList that contains a Template Column holding a DropDownlist. I am populating the DropDownList during the ItemDataBound event:
Protected Sub RadTreeList1_ItemDataBound(sender As Object, e As TreeListItemDataBoundEventArgs) Handles RadTreeList1.ItemDataBound
If TypeOf e.Item Is TreeListEditableItem AndAlso CType(e.Item, TreeListEditableItem).IsInEditMode Then
Dim tmpItem As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
Dim tmpControl As MultiView = TryCast(e.Item.FindControl("MultiView1"), MultiView)
Select Case tmpItem.DataItem("SelectionType").ToString
Case "DROPDOWN"
tmpControl.ActiveViewIndex = 0
Dim tmpDrop As DropDownList = TryCast(tmpControl.FindControl("DropDownList1"), DropDownList)
Using dbContext As New EntitiesModel
Dim tmpInt As Integer = tmpItem.DataItem("SowGroupID")
tmpDrop.AutoPostBack = True
tmpDrop.DataValueField = "SowSelectionID"
tmpDrop.DataTextField = "SelectionName"
tmpDrop.DataSource = dbContext.LibSOWSelections.Where(Function(c) c.SowGroupID = tmpInt).OrderBy(Function(c) c.Seq_No).ToList
tmpDrop.DataBind()
End Using
Case "CHECKBOX"
tmpControl.ActiveViewIndex = 1
Case "TEXTBOX"
tmpControl.ActiveViewIndex = 2
Case Else
tmpControl.ActiveViewIndex = 3
End Select
End If
End Sub
This works fine, but the problem is that I have the DropDownList posting back on change so that I can perform some logic, but when it posts back, I lose the selection of the dropdownlist. It is rebinding and I do not know where I can capture the selected value.
Any help would be appreciated.
Protected Sub RadTreeList1_ItemDataBound(sender As Object, e As TreeListItemDataBoundEventArgs) Handles RadTreeList1.ItemDataBound
If TypeOf e.Item Is TreeListEditableItem AndAlso CType(e.Item, TreeListEditableItem).IsInEditMode Then
Dim tmpItem As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
Dim tmpControl As MultiView = TryCast(e.Item.FindControl("MultiView1"), MultiView)
Select Case tmpItem.DataItem("SelectionType").ToString
Case "DROPDOWN"
tmpControl.ActiveViewIndex = 0
Dim tmpDrop As DropDownList = TryCast(tmpControl.FindControl("DropDownList1"), DropDownList)
Using dbContext As New EntitiesModel
Dim tmpInt As Integer = tmpItem.DataItem("SowGroupID")
tmpDrop.AutoPostBack = True
tmpDrop.DataValueField = "SowSelectionID"
tmpDrop.DataTextField = "SelectionName"
tmpDrop.DataSource = dbContext.LibSOWSelections.Where(Function(c) c.SowGroupID = tmpInt).OrderBy(Function(c) c.Seq_No).ToList
tmpDrop.DataBind()
End Using
Case "CHECKBOX"
tmpControl.ActiveViewIndex = 1
Case "TEXTBOX"
tmpControl.ActiveViewIndex = 2
Case Else
tmpControl.ActiveViewIndex = 3
End Select
End If
End Sub
This works fine, but the problem is that I have the DropDownList posting back on change so that I can perform some logic, but when it posts back, I lose the selection of the dropdownlist. It is rebinding and I do not know where I can capture the selected value.
Any help would be appreciated.