2

我有一个组合框,从表中加载组合框后,我从另一个表中获取选定的项目值,并将其绑定在组合框内,但是我的组合框已加载但没有显示其中的选定项目。这是我的代码。

<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);                                                        

                }
4

1 回答 1

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)
于 2013-08-05T21:38:57.190 回答