天道酬勤,学无止境

onclientclick

ASP.NET:如何使 onClientClick 在回发前完成工作?(ASP.NET: how to make onClientClick finish work before postback?)

问题 我有这样的控制: <asp:Button ID="save_all_filt" runat="server" Text="All data for filtered subjects" OnClientClick=" a= saveAllFilt(); return true; " onclick="save_all_filt_Click" /> saveAllFilt 包含一个 JQuery ajax 调用。 所以我在日志中看到的,我同时启动了回发和 saveAllFilt。 然而,在 Ajax 调用 saveAllFilt fninshes 之前,回发“延迟”并且什么也不做。 我想知道是否有这样的方法: 1. onClientClick,系统进入 saveAllFilt JS 函数并以某种方式等待(!)直到 Ajax 函数以这种或那种方式完成。 2. 只有当它完成时,真正的回发才开始发生。 我确实意识到 JQuery ajax 调用是事件驱动和异步的。 只是想阻止这些回发操作,直到它完成(AJAX 调用准备通过服务器回发发生的检索数据。) 回答1 将 jQuery AJAX 配置对象的 async 属性设置为false : $.ajax({ /* ... */ async : false /* ... */ })

2021-09-11 14:14:15    分类:技术分享    javascript   asp.net   ajax   onclick   onclientclick

OnClick and OnClientClick

I have an image button on a pop up page which is opened by another page <asp:ImageButton ID="Button_kalem_islemikaydet" runat="server" CausesValidation="False" ImageUrl="~/images/butonlar/buyuk/Kaydet.jpg" meta:resourcekey="Button_kalem_islemikaydetResource1" OnClick="Button_ust_islemikaydet_Click" OnClientClick="f2()" Width="100" /> f2() is <script type="text/javascript"> function f2() { opener.document.getElementById("TextBox1").value = "hello world"; opener.document.getElementById("HiddenField1").value = "hello world"; window.opener.location.href = window.opener.location.href; } </script>

2021-09-08 18:52:12    分类:问答    c#   javascript   asp.net   dopostback   onclientclick

ASP.NET: how to make onClientClick finish work before postback?

I have such a control: <asp:Button ID="save_all_filt" runat="server" Text="All data for filtered subjects" OnClientClick=" a= saveAllFilt(); return true; " onclick="save_all_filt_Click" /> saveAllFilt contains a JQuery ajax call. So what I see in log, I have simultaneous start of postback and saveAllFilt. Postback however "delays" and does nothing before Ajax call in saveAllFilt fninshes. I wonder if there is a way to do like this: 1. onClientClick, system goes into saveAllFilt JS function and somehow waits(!) till Ajax function finishes in this or that way. 2. Only when it is finished, a real

2021-09-05 03:23:53    分类:问答    javascript   asp.net   ajax   onclick   onclientclick

OnClientClick 不适用于 asp.net LinkBut​​ton(OnClientClick does not works on asp.net LinkButton)

问题 我有一个asp.net linkbutton ,其中包含OnClientClick属性,但是内部功能OnClientClick不会被调用,它直接跳转到OnClick功能。 以下是我使用 LinkBut​​ton 的两种方式: <asp:LinkButton ID="btn" CssClass="button" Text="Browse Thumbnail" runat="server" OnClientClick="return confirm('Are you sure you want to delete?');"> </asp:LinkButton> 和: <asp:LinkButton ID="lnkDelete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this slide?');" CommandName="DeleteThumbnail" CommandArgument='<%# Container.DataItemIndex %>'> <asp:Image ImageUrl="~/images/delete.gif" ID="imgDelete" runat="server"></asp:Image> </asp:LinkButton>

2021-08-11 12:36:33    分类:技术分享    c#   asp.net   linkbutton   onclientclick

OnClientClick does not works on asp.net LinkButton

I have an asp.net linkbutton, which contains the OnClientClick property, however the function within the OnClientClick never gets called, it directly jumps to OnClick function. Below are the 2 ways I am using LinkButton as: <asp:LinkButton ID="btn" CssClass="button" Text="Browse Thumbnail" runat="server" OnClientClick="return confirm('Are you sure you want to delete?');"> </asp:LinkButton> and: <asp:LinkButton ID="lnkDelete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this slide?');" CommandName="DeleteThumbnail" CommandArgument='<%# Container.DataItemIndex %>

2021-07-31 05:25:40    分类:问答    c#   asp.net   linkbutton   onclientclick

ASP.NET OnClientClick="返回假;" 不起作用(ASP.NET OnClientClick=“return false;” doesn't work)

问题 我只想在 Web 用户控件中添加一些客户端(JQuery Javascript)验证。 我放置了一个 OnClientClick 处理程序并调用了该函数。 但是,即使我返回“false”,OnClick 方法也总是会被触发。 我究竟做错了什么 ? 我使用的是 VS 2010,目标是使用 JQuery 1.4.2 的 4.0 框架。 和 JQuery UI 1.8.4。 这是一个示例代码: <td style="text-align:right"><asp:Button ID="btnAddSave" OnClientClick="return ValidateMail();" OnClick="btnAddSave_Click" runat="server" Text="Submit" /></td> 脚本方法: function ValidateMail() { alert("Bouton clicked"); return false; } 如果我在 Page_Load 事件中放置一个断点,我会看到我进入并且 btnAddSave_Click 事件也被执行。 回答1 您是否有返回true的点击事件处理程序(通过 jquery 注册)? 在这种情况下, OnClientClick的返回值将被忽略。 看看我的问题(和答案):为什么不从 OnClientClick 返回

2021-06-25 01:14:06    分类:技术分享    asp.net   validation   onclick   onclientclick

OnClick与OnClientClick的asp:CheckBox吗?(OnClick vs OnClientClick for an asp:CheckBox?)

问题 有谁知道为什么asp:CheckBox的客户端JavaScript处理程序需要像asp:Button那样是OnClick =“”属性而不是OnClientClick =“”属性? 例如,这有效: <asp:CheckBox runat="server" OnClick="alert(this.checked);" /> 并且没有(没有错误): <asp:CheckBox runat="server" OnClientClick="alert(this.checked);" /> 但这有效: <asp:Button runat="server" OnClientClick="alert('Hi');" /> 这不会(编译时错误): <asp:Button runat="server" OnClick="alert('hi');" /> (我知道Button.OnClick的用途是什么;我想知道为什么CheckBox不能以相同的方式工作...) 回答1 那太奇怪了。 我检查了CheckBox文档页面,该页面显示 <asp:CheckBox id="CheckBox1" AutoPostBack="True|False" Text="Label" TextAlign="Right|Left" Checked="True|False" OnCheckedChanged=

2021-04-20 23:51:34    分类:技术分享    asp.net   javascript   checkbox   onclick   onclientclick

How to pass bind or eval arguments with the client function “OnClientClicking”

I meet about problem to pass arguments to the client-side event OnClientClicking. I tried to use the String.Format () function, but it does not work. Do you have an idea for a workaround to send parameter linked with OnClientClicking? Code asp : <telerik:RadButton ID="bnt_meetingDelete" runat="server" OnClientClicking="<%# string.Format("confirmCallBackFn('{0}');",Eval("MeetingID")) %>" Image-ImageUrl="~/image/icone/delete-icon.png" Image-IsBackgroundImage="true" Width="21" Height="21" telerik:RadButton> Error IIS: Parser Error Description: An error occurred during the parsing of a resource

2021-04-19 04:30:20    分类:问答    asp.net   eval   bind   onclientclick

Why doesn't returning false from OnClientClick cancel the postback

I have a LinkButton where I use the OnClientClick property to ask the user whether he really wants to perform an action, e.g: <script> function confirmDelete() { return confirm('Do you really want to delete?'); } </script> <asp:LinkButton runat="server" OnClientClick="return confirmDelete()" ... /> This pattern usually works, but on this specific page, it doesn't. No matter whether I click OK or Cancel in the confirm dialog, the postback is executed. Just for completeness (to answer pst's question): the rendered HTML is OK. E.g. it looks like this: <a id="ctl00_c1_content_btnDelete" onclick=

2021-04-10 21:53:38    分类:问答    jquery   asp.net   postback   onclientclick

ASP.NET OnClientClick=“return false;” doesn't work

I just want to add some client side (JQuery Javascript) validation in a web user control. I put an OnClientClick handler and the function gets called. BUT, even if I return "false", the OnClick method always get fired. What am I doing wrong ? I'm with VS 2010, targeting the 4.0 framework with JQuery 1.4.2. and JQuery UI 1.8.4. Here's a sample code : <td style="text-align:right"><asp:Button ID="btnAddSave" OnClientClick="return ValidateMail();" OnClick="btnAddSave_Click" runat="server" Text="Submit" /></td> Script method : function ValidateMail() { alert("Bouton clicked"); return false; } If I

2021-04-10 20:33:04    分类:问答    asp.net   validation   onclick   onclientclick