Telerik RadComboBox AutomaticLoadOnDemand

时间:2012-05-29 05:03:41

标签: asp.net telerik telerik-combobox

我在我的项目中使用Telerik RadComboBox。我在RadComboBox上设置了EnableAutomaticLoadOnDemand="true"。它工作正常,但是当我想在page event的加载时设置所选项目时,它不会显示所选项目

2 个答案:

答案 0 :(得分:1)

使用按需加载模式,因此组合框没有任何项目。当你采取行动时,它只有一个项目。

在我看来,你应该得到特定的项目并在页面加载事件上手动将它添加到组合框中(就像这样(我不确定结构,只是一个想法。)

if (!IsPostBack)
{
    var itemSelected = service.GetById(Id); //item Id
    this.combobox.Items.Add(new RadComboboxItem(itemSelected.Id, itemSelected.Name));
    this.combobox.SeletedValue = Id.ToString();
}

答案 1 :(得分:0)

RadCombo允许设置SelectedValue和Text属性,即使其中没​​有任何项目。

相关问题