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.How to get disabled input element value in ASP.Net<p>Hi <a class="username" rel="nedash"> nedash</a>,</p> <p>The reason is simple, disabled inputs values aren't submitted to the server due to web-browsers submission limitation policy. The W3 spec says that input tags that are disabled are considered invalid and should not be submitted. Instead, use the readonly attribute:</p> <pre class="brush: csharp">&lt;input type=&#34;text&#34; readonly /&gt;</pre> <p>&nbsp;</p> <blockquote><cite>nedash says:</cite> <div class="line number4 index3 alt1"><code class="csharp spaces"></code><code class="csharp comments">// if checked.</code></div> <div class="line number5 index4 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">$(</code><code class="csharp string">'input[type=checkbox][id*=Chad]'</code><code class="csharp plain">).on(</code><code class="csharp string">'ifChecked'</code><code class="csharp plain">, function (</code><code class="csharp keyword">event</code><code class="csharp plain">) {</code></div> <div class="line number6 index5 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">$(</code><code class="csharp string">"#Txtmatn"</code><code class="csharp plain">).removeAttr(</code><code class="csharp string">"disabled"</code><code class="csharp plain">);</code></div> <div class="line number7 index6 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">$(</code><code class="csharp string">"#Txtmatn"</code><code class="csharp plain">).focus();</code></div> <div class="line number8 index7 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">});</code></div> <div class="line number9 index8 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp comments">// if uncheckd.</code></div> <div class="line number10 index9 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">$(</code><code class="csharp string">'input[type=checkbox][id*=Chad]'</code><code class="csharp plain">).on(</code><code class="csharp string">'ifUnchecked'</code><code class="csharp plain">, function (</code><code class="csharp keyword">event</code><code class="csharp plain">) {</code></div> <div class="line number11 index10 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">$(</code><code class="csharp string">"#Txtmatn"</code><code class="csharp plain">).attr(</code><code class="csharp string">"disabled"</code><code class="csharp plain">, </code><code class="csharp string">"disabled"</code><code class="csharp plain">);</code></div> <div class="line number12 index11 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">});</code></div> </blockquote> <p>&nbsp;replace above code with below</p> <pre class="brush: js">// if checked. $(&#39;input[type=checkbox][id*=Chad]&#39;).on(&#39;ifChecked&#39;, function (event) { $(&#34;#Txtmatn&#34;).removeAttr(&#34;disabled&#34;); $(&#34;#Txtmatn&#34;).removeAttr(&#39;readonly&#39;); $(&#34;#Txtmatn&#34;).focus(); }); // if uncheckd. $(&#39;input[type=checkbox][id*=Chad]&#39;).on(&#39;ifUnchecked&#39;, function (event) { $(&#34;#Txtmatn&#34;).attr(&#39;readonly&#39;, &#39;readonly&#39;); });</pre> <p>and if you dont want to use ReadOnly Property then you need to make use of Ajax Call like below</p> <pre class="brush: js">$(&#39;[id*=YourSavingButtonId]&#39;).click(function () { alert($(&#34;#Txtmatn&#34;).val()); //your ajax call comes here. return false; });</pre> <p>for more details on Ajax Calling refer below article</p> <h1 class="header"><a title="Send (Pass) multiple parameters to WebMethod in jQuery AJAX POST in ASP.Net'a" href="https://www.aspsnippets.com/Articles/Send-Pass-multiple-parameters-to-WebMethod-in-jQuery-AJAX-POST-in-ASPNet.aspx" target="_blank">Send (Pass) multiple parameters to WebMethod in jQuery AJAX POST in ASP.Net</a></h1>https://www.aspforums.net:443/Threads/712219/How-to-get-disabled-input-element-value-in-ASPNet/https://www.aspforums.net:443/Threads/712219/How-to-get-disabled-input-element-value-in-ASPNet/Mon, 29 May 2017 04:15:08 GMT