I am loading in a treeview in a combo box for a user editing page...the combox box loads demographics, On first load if you have previously selected demographics i have got the combo to select the previous one you have chosen from the database but comparing the text and using the following
If
Me.RadComboBox1.Attributes.Item("TreeviewSelectedItem") Is Nothing Then
If objuser.DivisionTwo <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.DivisionTwoDesc)
ElseIf objuser.DivisionOne <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.DivisionOneDesc)
ElseIf objuser.PearsonBusiness <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.PearsonBusinessDesc)
Else
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", "Please select a division")
End If
End If
this works and does preload the correct demographic in the combobox, but problem is when you press 'save' again and havent changed the combo box when it goes to save the demos if have this code to get the chosen id
Dim NewRadTreeDivisions As Telerik.Web.UI.RadTreeView
Dim DivisionValue As Integer
NewRadTreeDivisions = RadComboBox1.Items(0).FindControl(
"RadTreeView1")
If NewRadTreeDivisions.SelectedValue = "" Then
DivisionValue = 0
Else
DivisionValue = NewRadTreeDivisions.SelectedValue
End If
but now at this point NewRadTreeDivisions.SelectedValue does equal "" therefore sets it back to 0. even though the correct text is shown in the box the value isnt being passed through...how can i get this to keep the id???
thank you!