<telerik:RadComboBox ID="ddlDepartment" runat="server" AutoPostBack="true"
EmptyMessage="Choose a Department"
onselectedindexchanged = "ddlDepartment_SelectedIndexChanged"
EnableLoadOnDemand="True" >
</telerik:RadComboBox>
对应的 C# 数据绑定代码:
List<MdlPurchaseinvoice> objdpt = new List<MdlPurchaseinvoice>();
ddlDepartment.DataSource = SettingManager.GetDepartmentDetails();
ddlDepartment.DataTextField = "strDepartmentName";
ddlDepartment.DataValueField = "intDepartmentId";
ddlDepartment.DataBind();
现在我需要以编程方式在所述组合框中选择一个项目,我使用它
ddlDepartment.Selectedvalue = objpurchaseorder.intDepartmentId.ToString();
但不幸的是,错误显示在“Selectedvalue”附近,因为“它没有任何选定值的定义”。我该如何解决这个错误?