Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to avoid the page refresh at each server side event in asp.net?
    primarykey
    data
    text
    <p>I've designed a web page in asp.net. And in that page i placed html control too like <code>&lt;a&gt;</code> &amp; <code>&lt;div&gt;</code>. I have written one java script function which is hiding the <code>&lt;div&gt;</code> when i'm clicking on the <code>&lt;a&gt;</code> tag. Its working fine. But when i'm clicking on the asp.net button then page refresh occur again. And it is loading my previous design of the page. I set the <code>display:none</code> of the <code>&lt;div&gt;</code> at the design time. so it is hiding my <code>&lt;div&gt;</code> again when occuring any other server side event. And i don't want let it happen.</p> <p>Javascript function-</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function toggle5(showHideDiv, switchTag) { try { '&lt;%Session["temp"] = "'+more+'"; %&gt;'; var ele = document.getElementById(showHideDiv); var imageEle = document.getElementById(switchTag); if (ele.style.display == "block") { ele.style.display = "none"; imageEle.innerHTML = 'More'; } else { ele.style.display = "block"; imageEle.innerHTML = 'Less'; } } catch (err) { alert("Error"); } } &lt;/script&gt; </code></pre> <p>html code is-</p> <pre><code>&lt;div id="divSearch" style="float:left;height:100%;width:100%;"&gt; &lt;span style="float:right;height:27px;"&gt;&lt;a id="displayText" href="#" onclick="javascript:toggle5('toggleText', 'displayText');"&gt;More&lt;/a&gt;&lt;/span&gt; &lt;/div&gt; &lt;div id="toggleText" style="display:none;height:100%;width:100%;"&gt; &lt;div id="divCalls" style="width:24%;float:left;height:30%;"&gt; &lt;span style="float:left;width:100%;color:#3b5998;"&gt; &lt;asp:CheckBox ID="chkNoCall" runat="server" Text="No call made in " AutoPostBack="True" oncheckedchanged="chkNoCall_CheckedChanged"/&gt; &lt;asp:TextBox ID="txtNoCall" runat="server" Width="12%" Enabled="False"&gt;&lt;/asp:TextBox&gt;&lt;span&gt; days&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>C#.net code of the Checkbox-</p> <pre><code>protected void chkNoCall_CheckedChanged(object sender, EventArgs e) { if (chkNoCall.Checked == true) { txtNoCall.Enabled = true; } else { txtNoCall.Enabled = false; txtNoCall.Text = ""; } } </code></pre> <p>How to solve this problem?</p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload