Home > Enterprise >  When I select on a radiobutton with AutPostBack true, google recaptcha goes
When I select on a radiobutton with AutPostBack true, google recaptcha goes

Time:04-21

When I select on a radiobutton with AutPostBack true, google recaptcha goes. how can i solve this?

radiobutton with autopostback="true" attr. like this;

  <asp:RadioButtonList runat="server" ID="kvkk" CssClass="radioButton" OnSelectedIndexChanged="kvkkSelectedIndexChanged" AutoPostBack="true">
                        <asp:ListItem Value="0">Kabul Ediyorum</asp:ListItem>
                        <asp:ListItem Value="1">Kabul Etmiyorum</asp:ListItem>
                    </asp:RadioButtonList>

div for reCAPTCHA;

                            <div >
                                <div  data-sitekey="***************************"></div>
                            </div>

When i select on a item from radiobutton, reCAPTCHA is going.

enter image description here


enter image description here

CodePudding user response:

Try placing the Radio button in a update panel.

so, drag in the script manager, and then say this:

        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:RadioButtonList runat="server" ID="kvkk" CssClass="radioButton" OnSelectedIndexChanged="kvkkSelectedIndexChanged" AutoPostBack="true">
                <asp:ListItem Value="0">Kabul Ediyorum</asp:ListItem>
                <asp:ListItem Value="1">Kabul Etmiyorum</asp:ListItem>
            </asp:RadioButtonList>
        </ContentTemplate>
        </asp:UpdatePanel>

So, give the above a try. This does fire what we call a "partial" post-back, and your page load event will fire. And if you have any setup code, or loading of data or controls in the page load event, then make sure you test for first page postback like this:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


    If Not IsPostBack Then

        ' my setup and loading of controls data goes here

    End If


End Sub
  • Related