I have an ASPxFormLayout
which cointains a ASPxComboBox
, like this:
<dx:ASPxFormLayout runat="server" ID="MyFormLayout" Width="100%">
<Items>
<dx:LayoutGroup Width="100%" Caption="Dati Anagrafica" ColumnCount="3">
<Items>
<dx:LayoutItem>
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxComboBox ID="MyCombobox" runat="server" AutoPostBack="true" OnValueChanged="MyCombobox_ValueChanged"/>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</Items>
</LayoutGroup>
</Items>
</ASPxFormLayout>
I also need to add some CheckBoxes which I cannot add ASPx-side, cause their number is dynamic:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LayoutGroup layoutGroup = new LayoutGroup
{
Caption = "Services",
ColumnCount = 4
};
List<Services> services = ...
foreach (Services service in services)
{
LayoutItem layoutItem = new LayoutItem
{
Caption = service.ServiceName;
};
ASPxCheckBox checkBox = new ASPxCheckBox
{
Value = service.ID;
};
layoutItem.Controls.Add(checkBox);
layoutGroup.Items.Add(layoutItem);
}
MyFormLayout.Items.Add(layoutGroup);
}
}
And I obtain the result I want, But when the value of MyCombobox is changed, a PostBack is performed, but the CheckBoxes disappear.