Devexpress 复选框不起作用
Devexpress Checkbox is not functioning
我的意图是首先将 msform 设置为 visible = false,然后当我单击复选框时会出现 msform,但问题是当我单击复选框时 msform 不会 appear.The代码如下:
ASP.net
<dx:ASPxPopupControl ID="popup" ClientInstanceName="popup" HeaderText="Detail" AllowDragging="true" ShowOnPageLoad="false" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" runat="server" Width="60%" Height="60%">
<dx:ASPxCheckBox ID="mschkbox" runat="server" Text="Minesweeper?" Width="330px" OnCheckedChanged="mschkbox_CheckedChanged1" ClientIDMode="Static"></dx:ASPxCheckBox>
<dx:ASPxFormLayout ID="MsForm" Visible="False" runat="server" ClientIDMode="static">
<Items>
<dx:LayoutItem Caption="MS Product">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxTextBox ID="msproductbox" runat="server" Width="100%" CssClass="maxWidth">
<ValidationSettings Display="Dynamic" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Bottom" ErrorFrameStyle-Wrap="true"/>
</dx:ASPxTextBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
<dx:LayoutItem Caption="MS 1st Pilot Lot ID">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxTextBox ID="mslotidbox" runat="server" Width="100%" CssClass="maxWidth">
<ValidationSettings Display="Dynamic" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Bottom" ErrorFrameStyle-Wrap="true"/>
</dx:ASPxTextBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</dx:ASPxFormLayout>
</dx:ASPxPopupControl>
vb.net
Protected Sub mschkbox_CheckedChanged1(sender As Object, e As EventArgs)
If (mschkbox.Checked = True) Then
MsForm.Visible = True
Else
MsForm.Visible = False
End If
End Sub
必须将 AutoPostBack
属性设置为 True
以便在代码隐藏中正确处理 OnCheckedChanged
事件:
<dx:ASPxCheckBox ID="mschkbox" runat="server" AutoPostBack="True" Text="Minesweeper?"
Width="330px" OnCheckedChanged="mschkbox_CheckedChanged1" ClientIDMode="Static">
</dx:ASPxCheckBox>
如果你的ASPxCheckBox
放在ASPxGridView
的DataItemTemplate
里面,我建议你阅读this issue and this,因为你使用的是ClientIDMode="Static"
属性。
相关问题:
ASPxCheckBox - The server-side CheckedChanged event doesn't fire in Navbar
我的意图是首先将 msform 设置为 visible = false,然后当我单击复选框时会出现 msform,但问题是当我单击复选框时 msform 不会 appear.The代码如下:
ASP.net
<dx:ASPxPopupControl ID="popup" ClientInstanceName="popup" HeaderText="Detail" AllowDragging="true" ShowOnPageLoad="false" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" runat="server" Width="60%" Height="60%">
<dx:ASPxCheckBox ID="mschkbox" runat="server" Text="Minesweeper?" Width="330px" OnCheckedChanged="mschkbox_CheckedChanged1" ClientIDMode="Static"></dx:ASPxCheckBox>
<dx:ASPxFormLayout ID="MsForm" Visible="False" runat="server" ClientIDMode="static">
<Items>
<dx:LayoutItem Caption="MS Product">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxTextBox ID="msproductbox" runat="server" Width="100%" CssClass="maxWidth">
<ValidationSettings Display="Dynamic" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Bottom" ErrorFrameStyle-Wrap="true"/>
</dx:ASPxTextBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
<dx:LayoutItem Caption="MS 1st Pilot Lot ID">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxTextBox ID="mslotidbox" runat="server" Width="100%" CssClass="maxWidth">
<ValidationSettings Display="Dynamic" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Bottom" ErrorFrameStyle-Wrap="true"/>
</dx:ASPxTextBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</dx:ASPxFormLayout>
</dx:ASPxPopupControl>
vb.net
Protected Sub mschkbox_CheckedChanged1(sender As Object, e As EventArgs)
If (mschkbox.Checked = True) Then
MsForm.Visible = True
Else
MsForm.Visible = False
End If
End Sub
必须将 AutoPostBack
属性设置为 True
以便在代码隐藏中正确处理 OnCheckedChanged
事件:
<dx:ASPxCheckBox ID="mschkbox" runat="server" AutoPostBack="True" Text="Minesweeper?"
Width="330px" OnCheckedChanged="mschkbox_CheckedChanged1" ClientIDMode="Static">
</dx:ASPxCheckBox>
如果你的ASPxCheckBox
放在ASPxGridView
的DataItemTemplate
里面,我建议你阅读this issue and this,因为你使用的是ClientIDMode="Static"
属性。
相关问题:
ASPxCheckBox - The server-side CheckedChanged event doesn't fire in Navbar