简体   繁体   中英

<asp:Button> doesn't fire 'onclick' event with using UseSubmitBhaviour=false

The following code working fine for my working environment. But for my client, 'Onclick 'event doesn't fire. If we remove UseSubmitBehavior='false' and OnclientClick event from the page ,it is working fine for them. My Question is what is the cause of this problem. Is its because of browser settings or something? I dont know why its not firing. Please help me.

 <asp:ToolkitScriptManager  ID="ToolkitScriptManager1" AsyncPostBackTimeout="10000"
    runat="server">
</asp:ToolkitScriptManager>
<asp:Panel ID="Panel1"  runat="server">
    <table>
        <tr>
            <td align="left">
                UserName:
                <asp:TextBox ID="tbUserName" Width="150px" runat="server" ></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvUser" runat="server" ErrorMessage="Required" ControlToValidate="tbUserName"
                    ValidationGroup="validate"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td align="left">
                Password:
                <asp:TextBox Width="150px" ID="tbPassword" 
                    runat="server" TextMode="Password" ></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvPassword" runat="server" ErrorMessage="Required"
                    ControlToValidate="tbPassword" ValidationGroup="validate"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr id="rowCaptcha" runat="server">
            <td>
                <table style="margin-left: 30px">
                    <tr>
                        <td>
                            <telerik:radcaptcha errormessage="Please enter valid code" validatedtextboxid="tbRadcaptcha"
                                captchatextboxlabelcssclass="textBox" id="RadCaptcha1" captchaaudiolinkbuttontext=""
                                enablerefreshimage="true" captchaimage-renderimageonly="true" validationgroup="group"
                                runat="server"></telerik:radcaptcha>

                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Label ID="Label5" runat="server"  Text="Type the above code in text box"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:TextBox runat="server" ValidationGroup="group" ID="tbRadcaptcha"></asp:TextBox>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="left">
                <br />
                <asp:Button ID="btLogin" runat="server" Style="margin-left: 80px" UseSubmitBehavior="false"
                    OnClientClick="this.disabled=true" ValidationGroup="group" Text="Login" OnClick="btLogin_Click" />
            </td>
        </tr>
    </table>
</asp:Panel>

EDIT: This code is working fine for ie8,ie9 and ie10 in our local environment. But for my client this is not working who used ie8 and ie10(they don't use ie9). Is there any settings changed in their browser? Advance Thanks...

Yes, there might be client side issues caused by server side .NET frameworks which are not "up to date".

See for example : http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx

You should ask your client for the HTML source code of the page.

Ensure that :

  • it contains a call to __dopostback concatenated to your this.disabled=true from the onclick event
  • the generated code for the __dopostback function is the same on your working environment with the same browser
  • if it differs, your client might have missed some updates

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