简体   繁体   English

<asp:Button>使用UseSubmitBhaviour = false时不会触发&#39;onclick&#39;事件

[英]<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. 但对于我的客户来说,'Onclick'事件并不会触发。 If we remove UseSubmitBehavior='false' and OnclientClick event from the page ,it is working fine for them. 如果我们从页面中删除UseSubmitBehavior='false'OnclientClick事件,它可以正常工作。 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. 编辑:此代码适用于本地环境中的ie8,ie9和ie10。 But for my client this is not working who used ie8 and ie10(they don't use ie9). 但是对于我的客户来说,使用ie8和ie10(他们不使用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". 是的,可能存在由服务器端.NET框架引起的客户端问题,这些问题不是“最新的”。

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

You should ask your client for the HTML source code of the page. 您应该询问客户端页面的HTML源代码。

Ensure that : 确保这件事 :

  • it contains a call to __dopostback concatenated to your this.disabled=true from the onclick event 它包含一个对__dopostback的调用,该调用与onclick事件中的this.disabled=true连接
  • the generated code for the __dopostback function is the same on your working environment with the same browser 生成的__dopostback函数代码在您的工作环境中使用相同的浏览器是相同的
  • if it differs, your client might have missed some updates 如果不同,您的客户可能会错过一些更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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