Sep 22, 2010, 3:42 AM
Cannot insert an item manually in a ComboBox if it is connected to a Store
Hi everyone, when I'm using plain ASP.NET controls I use the AfterDataBound event of the control to insert a new item on the ComboBox that is usually the "Select All" item, for the instance in a ComboBox with a list of "accounts" I insert an item at index 0 with the text "all accounts", very well, I would like to to the same with an Ext.Net ComboBox, me code is below, it inserts a blank item on the combo, not sure why, could you please check? My combobox is linked to a <Ext:Store> that is linked to an <asp:SqlDataSource>.
Thanks!
Thanks!
<ext:ComboBox ID="cmbAccounts" runat="server" FieldLabel="Payees" Mode="Local" StoreID="StoreAccounts"
AllowBlank="false" DisplayField="Name" ValueField="ID" AutoDataBind="true" AnchorHorizontal="100%">
<DirectEvents>
<Added OnEvent="AccountsDataBinded"></Added>
</DirectEvents>
</ext:ComboBox>
protected void AccountsDataBinded(object sender, DirectEventArgs e)
{
Dictionary<string, object> values = new Dictionary<string, object>(2);
values.Add("All Accounts", "All Accounts");
this.cmbAccounts.InsertRecord(0, values);
this.cmbAccounts.SelectedItem.Value = "All Accounts";
}
Last edited by paul-2011; Sep 22, 2010 at 3:51 AM.