Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
My combo is empty until I click the dropdown (items request event is fire): so what is the best strategy to set an initial item (value and text) in RadComboBox while using Loading on Demand?
Thx
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
"server"
EnableLoadOnDemand
"True"
MarkFirstMatch
OnItemsRequested
"RadComboBox1_ItemsRequested"
>
</
protected
void
Page_Load(
object
sender, EventArgs e)
{
//adding initial RadComboBoxItem
if
(!Page.IsPostBack)
RadComboBoxItem item =
new
RadComboBoxItem();
item.Text =
"initial item"
;
item.Value =
"0"
RadComboBox1.Items.Add(item);
}
RadComboBox1_ItemsRequested(
o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
//Your code
<script type=
"text/javascript"
function
pageLoad() {
var
combo = $find(
"<%= RadComboBox1.ClientID %>"
);
comboItem =
Telerik.Web.UI.RadComboBoxItem();
comboItem.set_text(
"New Item"
combo.trackChanges();
combo.get_items().add(comboItem);
combo.commitChanges();
</script>