ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Disable LinkButton on AJAX Success using jQuery in ASP.Net<p>Hi <a class="username" rel="nauna">nauna</a>,</p> <p>For this you need to declare a global variable which hold the control on link button 1 click. Then after on success function disable the link button 1 and set the text.</p> <p>Refer below modified code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;script type=&#39;text/javascript&#39;&gt; var link; $(document).ready(function () { $(&#39;#spnCharLeft&#39;).css(&#39;display&#39;, &#39;none&#39;); var maxLimit = 1000; var minLimit = 15; var charactersLeft; $(&#39;#&lt;%= TextBox1.ClientID %&gt;&#39;).keyup(function () { var lengthCount = this.value.length; if (lengthCount &gt; minLimit) { $(&#39;#lblTick&#39;).text(&#39;✔ Perfect&#39;); $(&#39;#lblTick&#39;).css(&#39;color&#39;, &#39;#00ff21&#39;) charactersLeft = maxLimit - lengthCount + &#39; Characters Left&#39;; } if (lengthCount &gt; maxLimit) { $(&#39;#lblTick&#39;).text(&#39;X You have exceed the limit character&#39;); $(&#39;#lblTick&#39;).css(&#39;color&#39;, &#39;red&#39;) charactersLeft = &#39;Maximum length Exceeded&#39;; } if (lengthCount &lt; minLimit) { $(&#39;#lblTick&#39;).text(&#39;15 Min characters required&#39;); $(&#39;#lblTick&#39;).css(&#39;color&#39;, &#39;red&#39;) charactersLeft = maxLimit - lengthCount + &#39; Characters Left&#39;; } $(&#39;#spnCharLeft&#39;).css(&#39;display&#39;, &#39;block&#39;); $(&#39;#spnCharLeft&#39;).text(charactersLeft); }); $(&#34;[id*=LinkButton2]&#34;).bind(&#34;click&#34;, function () { var biddescription = $(&#34;[id*=TextBox1]&#34;).val(); var bidamount = $(&#34;[id*=TextBox2]&#34;).val(); var status = &#39;Active&#39;; var username = &#39;Test&#39;; var projectid = $(&#34;[id*=HiddenField1]&#34;).val(); var noofdays = $(&#34;[id*=TextBox3]&#34;).val(); if (Page_ClientValidate(&#34;sendproposal&#34;)) { $.ajax({ type: &#34;POST&#34;, url: &#34;allrequest.aspx/insertbid&#34;, data: &#34;{username: &#39;&#34; + username + &#34;&#39;, projectid: &#39;&#34; + projectid + &#34;&#39;, biddescription: &#39;&#34; + biddescription + &#34;&#39;, bidamount: &#39;&#34; + bidamount + &#34;&#39; , status: &#39;&#34; + status + &#34;&#39;, noofdays:&#39;&#34; + noofdays + &#34;&#39;}&#34;, contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: function (response) { $(&#34;[id*=TextBox1]&#34;).val(&#34;&#34;); $(&#34;[id*=TextBox2]&#34;).val(&#34;&#34;); $(&#34;[id*=TextBox3]&#34;).val(&#34;&#34;); $(&#39;#myModal&#39;).modal(&#39;hide&#39;); $(&#39;#spnCharLeft&#39;).css(&#39;display&#39;, &#39;none&#39;); $(&#39;#spnCharLeft2&#39;).css(&#39;display&#39;, &#39;none&#39;); $(&#39;#lblTick&#39;).text(&#39;&#39;); $(&#39;#lblTick2&#39;).text(&#39;✔ Perfect&#39;); // $(&#34;[id*=LinkButton1]&#34;).enabled = false; // $(&#34;[id*=LinkButton1]&#34;).val = &#34;Proposal sent&#34;; $(link).attr(&#34;disabled&#34;, &#34;disabled&#34;); $(link).text(&#34;Proposal sent&#34;); }, error: function (response) { alert(response.responseText); }, failure: function (response) { alert(response.responseText); } }); return false; } }); $(&#39;[id*=LinkButton1]&#39;).on(&#39;click&#39;, function () { link = $(this); var id = $(this).closest(&#39;div[class=&#34;list whitebg&#34;]&#39;).find(&#39;[id*=Label12]&#39;).html(); var oldURL = window.location.protocol + &#34;//&#34; + window.location.host + window.location.pathname; var newUrl = oldURL + &#34;?Id=&#34; + id; if (window.history != &#39;undefined&#39; &amp;&amp; window.history.pushState != &#39;undefined&#39;) { window.history.pushState({ path: newUrl }, &#39;&#39;, newUrl); $(&#39;#myModal&#39;).modal(&#39;show&#39;); $(&#34;#&lt;%=HiddenField1.ClientID %&gt;&#34;).val(id); } return false; }); (function () { var showChar = 400; var ellipsestext = &#34;...&#34;; $(&#39;.truncate&#39;).each(function () { var content = $(this).html(); if (content.length &gt; showChar) { var c = content.substr(0, showChar); var h = content; var html = &#39;&lt;div class=&#34;truncate-text&#34; style=&#34;display:block&#34;&gt;&#39; + c + &#39;&lt;span class=&#34;moreellipses&#34;&gt;&#39; + ellipsestext + &#39;&amp;nbsp;&amp;nbsp;&lt;a href=&#34;&#34; class=&#34;moreless more&#34; style=&#34;color:#bd59e2; font-weight:bold; font-style:normal;&#34;&gt;more&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&#34;truncate-text&#34; style=&#34;display:none&#34;&gt;&#39; + h + &#39;&lt;a href=&#34;&#34; class=&#34;moreless less&#34; style=&#34;color:#bd59e2; font-weight:bold; font-style:normal;&#34;&gt;Less&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&#39;; $(this).html(html); } }); $(&#34;.moreless&#34;).click(function () { var thisEl = $(this); if (thisEl.hasClass(&#34;less&#34;)) { thisEl.closest(&#39;.truncate-text&#39;).prev(&#39;.truncate-text&#39;).toggle(); thisEl.closest(&#39;.truncate-text&#39;).slideToggle(); } else { thisEl.closest(&#39;.truncate-text&#39;).toggle(); thisEl.closest(&#39;.truncate-text&#39;).next(&#39;.truncate-text&#39;).fadeToggle(); } return false; }); /* end iffe */ } ()); /* end ready */ }); &lt;/script&gt; &lt;div class=&#34;greybg&#34;&gt; &lt;div class=&#34;container&#34;&gt; &lt;div class=&#34;heading&#34;&gt; &lt;h2&gt; &lt;i class=&#34;fa fa-list c-l-grey&#34;&gt;&lt;/i&gt;Availble &lt;asp:Label ID=&#34;Label1&#34; runat=&#34;server&#34; Text=&#34;Pro&#34; CssClass=&#34;pro&#34;&gt;&lt;/asp:Label&gt;jects &lt;/h2&gt; &lt;/div&gt; &lt;asp:Label ID=&#34;Label7&#34; runat=&#34;server&#34; Text=&#34;Total Available Projects&#34;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&#34;Label8&#34; runat=&#34;server&#34; Text=&#34;Label&#34; CssClass=&#34;label label-warning&#34;&gt;&lt;/asp:Label&gt; &lt;span class=&#34;pull-right&#34;&gt;Available Offers &lt;asp:Label ID=&#34;Label9&#34; runat=&#34;server&#34; Text=&#34;Label&#34; CssClass=&#34;label label-danger&#34;&gt;&lt;/asp:Label&gt; &lt;/span&gt; &lt;div class=&#34;freejob&#34;&gt; &lt;div class=&#34; list whitebg&#34;&gt; &lt;div class=&#34;thumbnail&#34;&gt; &lt;div class=&#34;row bold&#34;&gt; &lt;div class=&#34;col-md-2&#34;&gt; Date: &lt;/div&gt; &lt;div class=&#34;col-md-8 nopadding&#34;&gt; Project Details &lt;/div&gt; &lt;div class=&#34;col-md-1 center&#34;&gt; Budget &lt;/div&gt; &lt;div class=&#34;col-md-1 center&#34;&gt; Offers &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;asp:ListView ID=&#34;ListView1&#34; runat=&#34;server&#34; OnItemDataBound=&#34;ListView1_ItemDataBound&#34;&gt; &lt;ItemTemplate&gt; &lt;div class=&#34;list whitebg&#34;&gt; &lt;div class=&#34;thumbnail&#34;&gt; &lt;div class=&#34;caption&#34;&gt; &lt;asp:Label ID=&#34;Label12&#34; runat=&#34;server&#34; Text=&#39;&lt;%# Eval(&#34;projectid&#34;) %&gt;&#39;&gt;&lt;/asp:Label&gt; &lt;asp:LinkButton ID=&#34;LinkButton1&#34; runat=&#34;server&#34; data-toggle=&#34;modal&#34; data-target=&#34;#myModal&#34; CssClass=&#34;color-btn pull-right&#34;&gt; Send &lt;asp:Label ID=&#34;Label6&#34; runat=&#34;server&#34; Text=&#34;Pro&#34; CssClass=&#34;pro&#34;&gt;&lt;/asp:Label&gt;posal &lt;/asp:LinkButton&gt; &lt;/div&gt; &lt;div class=&#34;row&#34;&gt; &lt;div class=&#34;col-md-2&#34;&gt; &lt;asp:Label ID=&#34;Label3&#34; runat=&#34;server&#34; Text=&#39;&lt;%# Eval(&#34;projectdate&#34;) %&gt;&#39;&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;div class=&#34;col-md-8 nopadding&#34;&gt; &lt;h5&gt; &lt;asp:Image ID=&#34;Image1&#34; runat=&#34;server&#34; ImageUrl=&#39;&lt;%# Eval(&#34;buyerimage&#34;) %&gt;&#39; CssClass=&#34;img-circle pull-left&#34; Width=&#34;30px&#34; Height=&#34;30px&#34; /&gt; &lt;asp:Label ID=&#34;Label2&#34; runat=&#34;server&#34; Text=&#39;&lt;%# Eval(&#34;title&#34;) %&gt;&#39;&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;small&gt; &lt;div class=&#34;truncate&#34;&gt; &lt;%# Eval(&#34;description&#34;) %&gt; &lt;/div&gt; &lt;/small&gt; &lt;/h5&gt; &lt;/div&gt; &lt;div class=&#34;col-md-1 bold center&#34;&gt; &lt;asp:Label ID=&#34;Label4&#34; runat=&#34;server&#34; Text=&#39;&lt;%# Eval(&#34;budget&#34;) %&gt;&#39;&gt;&lt;/asp:Label&gt;&lt;/div&gt; &lt;div class=&#34;col-md-1 center&#34;&gt; &lt;asp:Label ID=&#34;Label5&#34; runat=&#34;server&#34; Text=&#39;&lt;%# Eval(&#34;totaloffer&#34;) %&gt;&#39;&gt;&lt;/asp:Label&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;hr class=&#34;nomargin&#34; /&gt; &lt;/ItemTemplate&gt; &lt;/asp:ListView&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&#34;modal fade&#34; id=&#34;myModal&#34; tabindex=&#34;-1&#34; role=&#34;dialog&#34; aria-labelledby=&#34;myModalLabel&#34;&gt; &lt;div class=&#34;modal-dialog&#34; role=&#34;document&#34;&gt; &lt;div class=&#34;modal-content sahdow&#34;&gt; &lt;div class=&#34;modal-header&#34;&gt; &lt;button type=&#34;button&#34; class=&#34;close&#34; data-dismiss=&#34;modal&#34; aria-label=&#34;Close&#34;&gt; &lt;span aria-hidden=&#34;true&#34;&gt;&amp;times;&lt;/span&gt;&lt;/button&gt; &lt;h4 class=&#34;modal-title&#34; id=&#34;myModalLabel&#34;&gt; Send &lt;asp:Label ID=&#34;Label10&#34; runat=&#34;server&#34; Text=&#34;Pro&#34; CssClass=&#34;pro&#34;&gt;&lt;/asp:Label&gt;posal&lt;/h4&gt; &lt;/div&gt; &lt;div class=&#34;modal-body greybg nopadding&#34;&gt; &lt;div class=&#34;form form-horizontal noshadow greybg nopadding&#34;&gt; &lt;div class=&#34;form-group padding &#34;&gt; Description&lt;asp:RegularExpressionValidator Display=&#34;Dynamic&#34; ControlToValidate=&#34;TextBox1&#34; ID=&#34;RegularExpressionValidator3&#34; ValidationExpression=&#34;^[\s\S]{15,1000}$&#34; runat=&#34;server&#34; ErrorMessage=&#34;Minimum 15 and Maximum 1000 characters required.&#34; CssClass=&#34;required&#34; ValidationGroup=&#34;sendproposal&#34;&gt;&lt;/asp:RegularExpressionValidator&gt;&lt;asp:RequiredFieldValidator ID=&#34;RequiredFieldValidator1&#34; ValidationGroup=&#34;sendproposal&#34; runat=&#34;server&#34; ErrorMessage=&#34;Required&#34; ControlToValidate=&#34;TextBox1&#34; CssClass=&#34;required&#34; SetFocusOnError=&#34;True&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;asp:TextBox ID=&#34;TextBox1&#34; runat=&#34;server&#34; TextMode=&#34;MultiLine&#34;&gt;&lt;/asp:TextBox&gt; &lt;span id=&#34;lblTick&#34;&gt;&lt;/span&gt;&lt;span id=&#34;spnCharLeft&#34; style=&#34;color: #a33acb&#34; class=&#34;pull-right&#34;&gt; &lt;/span&gt; &lt;/div&gt; &lt;div class=&#34;form-group&#34;&gt; &lt;div class=&#34;col-md-5 &#34;&gt; &lt;asp:Label ID=&#34;Label11&#34; runat=&#34;server&#34; Text=&#34;Pro&#34; CssClass=&#34;pro&#34;&gt;&lt;/asp:Label&gt; Cost: &lt;asp:TextBox ID=&#34;TextBox2&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID=&#34;RequiredFieldValidator2&#34; ValidationGroup=&#34;sendproposal&#34; runat=&#34;server&#34; ErrorMessage=&#34;Required&#34; ControlToValidate=&#34;TextBox2&#34; CssClass=&#34;required&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/div&gt; &lt;div class=&#34;col-md-5 &#34;&gt; Delivery Time &lt;asp:TextBox ID=&#34;TextBox3&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID=&#34;RequiredFieldValidator3&#34; ValidationGroup=&#34;sendproposal&#34; runat=&#34;server&#34; ErrorMessage=&#34;Required&#34; ControlToValidate=&#34;TextBox3&#34; CssClass=&#34;required&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/div&gt; &lt;div class=&#34;col-md-2&#34;&gt; &lt;br /&gt; &lt;asp:LinkButton ID=&#34;LinkButton2&#34; runat=&#34;server&#34; ValidationGroup=&#34;sendproposal&#34; CssClass=&#34;color-btn pull-right&#34; Width=&#34;100%&#34;&gt;Send&lt;/asp:LinkButton&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&#34;form-group&#34;&gt; &lt;/div&gt; &lt;br /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;asp:HiddenField ID=&#34;HiddenField1&#34; runat=&#34;server&#34; /&gt;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/122118/Disable-LinkButton-on-AJAX-Success-using-jQuery-in-ASPNet/https://www.aspforums.net:443/Threads/122118/Disable-LinkButton-on-AJAX-Success-using-jQuery-in-ASPNet/Wed, 08 Aug 2018 06:39:52 GMTDisable LinkButton on AJAX Success using jQuery in ASP.Net<blockquote><cite>dharmendr says:</cite> <pre><code class="html spaces"></code><code class="html plain">$(link).attr("disabled", "disabled");</code></pre> </blockquote> <p>&nbsp;Replace the above line with the below.</p> <pre class="brush: html">$(link).prop(&#34;disabled&#34;, true);</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/122118/Disable-LinkButton-on-AJAX-Success-using-jQuery-in-ASPNet/https://www.aspforums.net:443/Threads/122118/Disable-LinkButton-on-AJAX-Success-using-jQuery-in-ASPNet/Thu, 16 Aug 2018 01:10:45 GMT