【发布时间】:2013-11-22 03:54:18
【问题描述】:
在 asp.net 表单中,我有一组单选按钮,它们都具有相同的 groupID。在同一张表格上,我有一个重置按钮。在重置按钮的代码中,我将单选按钮设置为默认选中,如 rb.Checked = true。问题是单选按钮的选中状态没有改变。为什么不呢?
ASP.Net:
<asp:Table ID="tblFullText" runat="server" Width="95%" HorizontalAlign="Center" Font-Size="10pt" CellSpacing="0"
BorderWidth="1px" CellPadding="0" GridLines="Both" BorderStyle="Solid" BorderColor="#c0c0c0">
<asp:TableRow HorizontalAlign="Center" BackColor="LightSteelBlue" Font-Bold="True">
<asp:TableCell ColumnSpan="3" Font-Bold="true" Text="FULL TEXT SEARCH PARAMETERS"></asp:TableCell>
</asp:TableRow>
<asp:TableRow HorizontalAlign="Center" BackColor="LightSteelBlue" Font-Bold="True">
<asp:TableCell Width="50%" Text="Search Criteria"></asp:TableCell>
<asp:TableCell Width="17%" Text="Query Operator"></asp:TableCell>
<asp:TableCell Width="33%" Text="Query Expression Type"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Width="50%" HorizontalAlign="Center"><asp:textbox id="tbFullTextSearchCriteria" runat="server" Width="98%"></asp:textbox></asp:TableCell>
<asp:TableCell Width="17%" HorizontalAlign="Center">
<asp:RadioButton runat="server" GroupName="QueryOp" ID="rbQueryOpAnd" Text="<b>AND</b>" />
<asp:RadioButton runat="server" GroupName="QueryOp" ID="rbQueryOpOR" Text="<b>OR</b>" />
</asp:TableCell>
<asp:TableCell Width="33%" HorizontalAlign="Center">
<asp:RadioButton runat="server" GroupName="QueryExpType" ID="rbQueryExpTypeAll" Text="<b>All Words</b>" />
<asp:RadioButton runat="server" GroupName="QueryExpType" ID="rbQueryExpTypeAny" Text="<b>Any Word</b>" />
<asp:RadioButton runat="server" GroupName="QueryExpType" ID="rbQueryExpTypeExact" Text="<b>Exact Phrase</b>" />
<asp:RadioButton runat="server" GroupName="QueryExpType" ID="rbQueryExpTypeExpr" Text="<b>Expression</b>" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
后面的代码:
Protected Sub btnClearFields_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClearFields.Click
rbQueryOpAnd.Checked = True
End Sub
【问题讨论】:
-
你能发布你的代码吗?
标签: asp.net radio-button