Sep 25, 2013, 2:29 AM
[CLOSED] CheckboxGroup Returns No CheckedItems
I define a CheckboxGroup:
<ext:CheckboxGroup ID="Environments" runat="server" LabelCls="label-cls" FieldLabel="Environment" ColumnsNumber="1" Disabled="true" />
The Checkboxes themselves are populated from a Store like this:<ext:Store ID="EnvironmentsStore" runat="server" AutoLoad="true">
<Proxy>
<ext:AjaxProxy Json="true" Url='<%#environmentsUrl%>' AutoDataBind="true">
<ActionMethods Read="POST" Create="POST" />
<Headers>
<ext:Parameter Name="Accept" Value="application/json" />
<ext:Parameter Name="Content-Type" Value="application/json" />
</Headers>
<Reader>
<ext:JsonReader Root="" />
</Reader>
<Writer>
<ext:JsonWriter Root="" Encode="true" />
</Writer>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="EnvironmentsModel" runat="server">
<Fields>
<ext:ModelField Name="RECORD_ENVIRONMENT" Type="String" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Load Fn="loadEnvironments" />
</Listeners>
</ext:Store>
This is the listener javascript function:var loadEnvironments = function (store, records) {
Ext.getCmp('Environments').removeAll();
Ext.getCmp('Environments').add(Ext.Array.map(records, function (record) {
return {
id: record.get('RECORD_ENVIRONMENT').replace("/","") + "_CB",
boxLabel: record.get('RECORD_ENVIRONMENT'),
inputValue: record.get('RECORD_ENVIRONMENT')
};
}));
}
I need to be able to iterate through the checked boxes in code behind as follows:foreach (Checkbox box in Environments.CheckedItems)
{
box.Checked = false;
}
orstring ENVIRONMENT_LIST = "";
foreach (Checkbox box in Environments.CheckedItems)
{
ENVIRONMENT_LIST += box.InputValue + ",";
}
But no matter what I can never get any CheckedItems. What am I missing?
Last edited by Daniil; Sep 26, 2013 at 6:12 AM.
Reason: [CLOSED]