简体   繁体   中英

How can I stop auto post back on selecting the radio buttons which shows grid on selecting Yes

------Code for Radio Buttons. On selecing Yes page is postback and on selecting No also page auto post back. I want not to post back page on selecting No. Please help

<asp:Panel TabIndex="-1" runat="server" ID="pnlMedicalLicenseInfo">
    <asp:RadioButton ID="rboMedicalLicenseYes" AutoPostBack="true" Checked="true" Value="1" runat="server" GroupName="rboMedicalLicense" ClientIDMode="Static"></asp:RadioButton>
    <asp:RadioButton ID="rboMedicalLicenseNo" AutoPostBack="true" Value="0" runat="server" GroupName="rboMedicalLicense" ClientIDMode="Static" />
    <asp:CustomValidator ID="cusValMedicalLicense" Display="Dynamic" Enabled="false" runat="server" ClientValidationFunction="rbtnMedicalLicenseValidate" ValidationGroup="SD" CssClass="DisplayErrorMessage HideControl">
       <%=base.GetResourceValue("WUCStudyDetailsNonHuman_cvrbPaidDirectly") %>
    </asp:CustomValidator>
    <span class="DisplayErrorMessage" style="display: none" id="divMedicalLicenseErr">
       <%=base.GetResourceValue("WUCStudyDetailsNonHuman_divMedicalLicenseErr") %>
    </span>
</asp:Panel>

This setting is what tells the control to post-back automatically:

AutoPostBack="true"

If you don't want that, simply remove that attribute from your controls:

<asp:RadioButton ID="rboMedicalLicenseYes" Checked="true" Value="1" runat="server" GroupName="rboMedicalLicense" ClientIDMode="Static"></asp:RadioButton>
<asp:RadioButton ID="rboMedicalLicenseNo" Value="0" runat="server" GroupName="rboMedicalLicense" ClientIDMode="Static" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM