This question is locked. New answers and comments are not allowed.
Craig Fisher
Top achievements
Rank 1
Craig Fisher
asked on 09 Feb 2010, 10:28 PM
For a regular dropdown list I can do this:
<%
= Html.DropDownList("Status", (IEnumerable<SelectListItem>)ViewData["filterstatuses"])%>
Is there an equivalent way of loading the items in a RadComboBox?
6 Answers, 1 is accepted
0
Hello Craig Fisher,
No, there is no such method for RadComboBox. You should enumerate the data and create RadComboBoxItem objects on the fly. Of course you can create an extension method for this as well.
Regards,
Atanas Korchev
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
No, there is no such method for RadComboBox. You should enumerate the data and create RadComboBoxItem objects on the fly. Of course you can create an extension method for this as well.
Regards,
Atanas Korchev
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Craig Fisher
Top achievements
Rank 1
answered on 02 Mar 2010, 11:09 PM
I'm trying to figure out how to do this without requiring code in the code-behind for the view.
The RadComboBox doesn't seem to support client side data binding though.
Can you offer some guidance on how to do this?
Do you have plans to provide an MVC implementation of RadComboBox?
Thanks.
0
Hello Craig Fisher,
You can do this in the view - no need to use codebehind:
<telerik:RadComboBox runat="server" id="RadComboBox1" />
<%
foreach(SelectListItem item in ((IEnumerable<SelectListItem>)ViewData["something"]))
{
RadComboBox1.Items.Add(new RadComboBoxItem
{
Text = item.Text,
Value = item.Value
});
}
%>
You can also add items with JavaScript as shown here.
We have a combobox component logged for implementation. You can vote for it here.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can do this in the view - no need to use codebehind:
<telerik:RadComboBox runat="server" id="RadComboBox1" />
<%
foreach(SelectListItem item in ((IEnumerable<SelectListItem>)ViewData["something"]))
{
RadComboBox1.Items.Add(new RadComboBoxItem
{
Text = item.Text,
Value = item.Value
});
}
%>
You can also add items with JavaScript as shown here.
We have a combobox component logged for implementation. You can vote for it here.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Craig Fisher
Top achievements
Rank 1
answered on 03 Mar 2010, 11:48 PM
Thanks Atanas.
I just tried that code and the combox box is being rendered with no items.
(I gave my vote for the MVC combo box)
0
Accepted
Hi Craig Fisher,
I am sorry - the population code must come before the declaration:
<%
foreach(SelectListItem item in ((IEnumerable<SelectListItem>)ViewData["something"]))
{
RadComboBox1.Items.Add(new RadComboBoxItem
{
Text = item.Text,
Value = item.Value
});
}
%>
<telerik:RadComboBox runat="server" id="RadComboBox1" />
I am sending you a sample project for your reference.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I am sorry - the population code must come before the declaration:
<%
foreach(SelectListItem item in ((IEnumerable<SelectListItem>)ViewData["something"]))
{
RadComboBox1.Items.Add(new RadComboBoxItem
{
Text = item.Text,
Value = item.Value
});
}
%>
<telerik:RadComboBox runat="server" id="RadComboBox1" />
I am sending you a sample project for your reference.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Craig Fisher
Top achievements
Rank 1
answered on 04 Mar 2010, 05:06 PM
Ahh, that helps! Thanks Atanas!