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

treeview in combo box problem loading selected value

1 Answer 63 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Caroline
Top achievements
Rank 1
Caroline asked on 17 Jul 2009, 02:17 PM
Hello

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!

 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 20 Jul 2009, 01:07 PM
Hi Caroline,

The provided code is not enough to replicate the issue, could you please open a support ticket and send us a simple page demonstrating the problem there? Thanks a lot

Greetings,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Caroline
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or