我有一个组合框,在从表中加载组合框之后,我从另一个表中获取所选项目值,并将其绑定在组合框内, 但是我的组合框装满了,但没有显示我里面的选定项目。 这是我的代码。
<ext:ComboBox runat="server" ID="cmbPerson" EmptyText="select person" AllowBlank="false"
Editable="false" Icon="User" Flex="1" ValueField="Id" DisplayField="Name" FieldLabel="">
<Store>
<ext:Store ID="strcmbPerson" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
protected void Page_Load(object sender, EventArgs e)
{
//I populated combobox from databese,
strcmbPerson.DataSource = person_bll.Get();
strcmbPerson.DataBind();
//later I wanna set selected item value to the "person_obj.PersonId"
cmbPerson.SelectedItem.Value = Convert.ToString(person_obj.PersonId);
}
答案 0 :(得分:3)
Dim ExtItem As New Ext.Net.ListItem
ExtItem.Value = dst.Tables(0).Rows(i).Item(2)
ExtItem.Mode = ParameterMode.Raw
MultiCombo1.SelectedItems.Add(ExtItem)