Apr 24, 2013, 1:08 PM
[CLOSED] Combobox, StoreId and set value in code behind
Hi All,
May be a silly question but I didn't find how to answer on here on forum. I have a store which is populated in codebehind and combobox which is having StoreID set to this store. My question is how to setup selected value in code behind? Here a code:
Thanks,
Alexander
May be a silly question but I didn't find how to answer on here on forum. I have a store which is populated in codebehind and combobox which is having StoreID set to this store. My question is how to setup selected value in code behind? Here a code:
<ext:FormPanel ItemID="AccountFormPanel" Url="/Membership/SubmitRegistration" runat="server" BodyStyle="background:transparent;" Padding="5" Layout="AnchorLayout" Border="false" DefaultAnchor="100%">
<Bin>
<ext:Store ID="CompanyCountryStore" runat="server">
<Model>
<ext:Model runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Code" />
<ext:ModelField Name="CodeString" />
<ext:ModelField Name="Domain" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Bin>
<Items>
<ext:ComboBox ID="CompanyCountryId" StoreID="CompanyCountryStore" runat="server" ValueField="Id" DisplayField="Name" Editable="false" TypeAhead="true" ForceSelection="true" SelectOnFocus="true" FieldLabel="Country" EmptyText="Please, select" MinChars="1" Flex="1" SimpleSubmit="true" />
</Items>
</ext:FieldSet>
</Items>
</ext:FormPanel>
The store is populated like this:<script runat="server">
public void OnPage_Load()
{
CompanyCountryStore.DataSource = CountryContainer.GetItemsList();
CompanyCountryStore.DataBind();
}
</script>
How I can assign selected valut to my combox in code behind? I tried CompanyCountryId.SetValue("F0B385AB-780D-47D6-AB68-2BDC9FBA2FF0") but this doesn't work.Thanks,
Alexander
Last edited by Daniil; Apr 24, 2013 at 4:19 PM.
Reason: [CLOSED]