I am manually loading a combobox during a postback with:
As I add an item, how do I set/add its value? No sooner that I posted this, than I think I found the answer. See below. If it is not correct please let me know.
Once the entire contol is populated by the above code, I would like to set the Text property of the control to the user's setting. Let's say the user has a Text value of "Maine" and a Value of "ME".. My code is not setting the TEXT property during postback.
What is the correct way to set the TEXT property during a Postback?
Finally and this is a programing best practices question, do you think I should set the SelectedItem and/or SelectedValue property of the control when it is known, as in the above example? Or is just populating the TEXT property field sufficient?
Thanks,
pat
Do While CoReader.Read If CoReader.IsDBNull(0) Then StateNameString = "" Else StateNameString = CoReader.Item("StateName").ToString.Trim Dim item As New RadComboBoxItem(StateNameString) Me.RadComboBoxState.Items.Add(item)LoopAs I add an item, how do I set/add its value? No sooner that I posted this, than I think I found the answer. See below. If it is not correct please let me know.
Do While CoReader.Read If CoReader.IsDBNull(0) Then StateNameString = "" Else StateNameString = CoReader.Item("StateName").ToString.Trim Dim item As New RadComboBoxItem(StateNameString) If CoReader.IsDBNull(1) Then item.Value = "" Else item.Value = CoReader.Item("State").ToString.Trim.ToUpper Me.RadComboBoxState.Items.Add(item)LoopOnce the entire contol is populated by the above code, I would like to set the Text property of the control to the user's setting. Let's say the user has a Text value of "Maine" and a Value of "ME".. My code is not setting the TEXT property during postback.
If CoReader.IsDBNull(0) Then Me.RadComboBoxState.Text = "" Else RadComboBoxState.Text = CoReader.Item("StateName").ToString.TrimWhat is the correct way to set the TEXT property during a Postback?
Finally and this is a programing best practices question, do you think I should set the SelectedItem and/or SelectedValue property of the control when it is known, as in the above example? Or is just populating the TEXT property field sufficient?
Thanks,
pat