0
<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”附近,因为“它没有任何选定值的定义”。我该如何解决这个错误?

4

1 回答 1

1

我已经检查了 Telerik 网站,SelectedValue Property Exist ,

我认为您使用了错误的 CASE ,使用SelectedValue而不是Selectedvalue

ddlDepartment.SelectedValue = objpurchaseorder.intDepartmentId.ToString();// New Code

ddlDepartment.Selectedvalue = objpurchaseorder.intDepartmentId.ToString();// OLd Code
于 2013-09-03T06:25:39.670 回答