单列的ASPxFormLayout直接前台控制就可以了,多列的前台控制后会出现空白
<dx:LayoutItem Caption="内容类型" Height="40px">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer runat="server">
<dx:ASPxComboBox ID="ComboBoxType" runat="server" OnSelectedIndexChanged="ComboBoxType_SelectedIndexChanged" AutoPostBack="true" Width="80%"><Items>
<dx:ListEditItem Text="函数" Value="1" />
<dx:ListEditItem Text="实物" Value="2" />
</Items>
</dx:ASPxComboBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
<CaptionSettings HorizontalAlign="Right" VerticalAlign="Middle" />
</dx:LayoutItem>
前台设置AutoPostBack="true"
var type = ComboBoxType.Text;
LayoutGroup layg = ASPxFormLayout1.Items[0] as LayoutGroup;
LayoutItem layi = layg.Items[2] as LayoutItem;
if (type == "11")
{
layi.Visible = true;
}
else
{
layi.Visible = false;
}
来源:https://www.cnblogs.com/heyiping/p/10980639.html