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

Adding a 3rd item to my combo box

3 Answers 48 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
stevied
Top achievements
Rank 2
stevied asked on 28 Nov 2011, 11:25 PM
I have a rad combo box which is being databound as follows...

'Now populate the Managers Drop down
           rsMain = GeneralDataMethod.GetAllApprovedManagers
           While rsMain.Read
               cboManager.Items.Add(New RadComboBoxItem(rsMain("Manager"), rsMain("ManagerID")))
 
           End While
           cboManager.Items.Insert(0, New RadComboBoxItem("- Please select -", ""))

I would like to add a 3rd item from the database into the combo box (email address, the sp gives me this) but not display in the drop down but have it available to me when the user selects a manager from the drop down.

Is this possible using code behind?

TIA.

S


3 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 30 Nov 2011, 04:39 PM
Hi Stevied,

As I understand - you are populating the RadComboBox control with data from a database and you set the Text property of the RadComboBox items to "Manager" and the Value property to "ManagerID".
In case you want to add e-mail information for each item(Manager) - you can simply set this data as a Custom Attribute.
Please take a look at the "ComboBox / Custom Attributes" online demo and “Custom Attributes” help article.

Best wishes,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
stevied
Top achievements
Rank 2
answered on 30 Nov 2011, 05:52 PM
Thanks for your feedback Kalina, i have seen both these posts but I am using code behind to database my Rad Combo Box as the following codes shows..

ASPX

<Telerik:RadComboBox ID="cboManager" runat="server" AutoPostBack="true" />

aspx.vb

'Now populate the Managers Drop down
           rsMain = GeneralDataMethod.GetAllApprovedManagers
           While rsMain.Read
               cboManager.Items.Add(New RadComboBoxItem(rsMain("Manager"), rsMain("ManagerID")))
 
           End While
           cboManager.Items.Insert(0, New RadComboBoxItem("- Please select -", ""))

using this method i cannot see how or where i can add in the attibutes?

Many thanks,

S
0
Dimitar Terziev
Telerik team
answered on 05 Dec 2011, 02:31 PM
Hello Stevied,

You could add attributes in the following manner:
'Now populate the Managers Drop down
       rsMain = GeneralDataMethod.GetAllApprovedManagers
       While rsMain.Read
 
           Dim item As New RadComboBoxItem(rsMain("Manager"), rsMain("ManagerID"))
           item.Attributes("Attribute") = rsMain("Email")
           cboManager.Items.Add(item)
 
       End While
       cboManager.Items.Insert(0, New RadComboBoxItem("- Please select -", ""))

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
stevied
Top achievements
Rank 2
Answers by
Kalina
Telerik team
stevied
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Share this question
or