0
在一個asp.net窗體中,我有一組單選按鈕,全部使用相同的組ID。在相同的表單上我有一個重置按鈕。在重置按鈕的代碼中,我設置了我希望成爲缺省值的單選按鈕,如rb.Checked = true。問題是單選按鈕的選中狀態不會改變。爲什麼不?ASP.Net單選按鈕不會改變狀態
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
你可以發佈你的代碼嗎? –
上面貼出的代碼。 –