Click here to Skip to main content
15,900,325 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
My JavaScript

<script type="text/javascript">
function showRecurringBlock(ctl00_MainContent_ddlRecurrence) {
debugger;
var vis = "none";
if (document.getElementById("ctl00_MainContent_chkIsRecurringTask").checked)
vis = "block";
document.getElementById(ctl00_MainContent_ddlRecurrence).style.display = vis;
}
</script>
<script type="text/javascript">
function check_dd() {
if (document.getElementById('ctl00_MainContent_ddlRecurrence').value == "2") {
document.getElementById('ctl00_MainContent_divRecurringDays').style.display = 'block';
} else {
document.getElementById('ctl00_MainContent_divRecurringDays').style.display = 'none';
}
}
</script>

Question ->
DropDownList id= ddlRecurrence Control disappeared after page post back
Posted

1 solution

This problem can be solved by session state means specific to ASP.NET, https://msdn.microsoft.com/en-us/library/ms178581.aspx[^].

But as JavaScript is mentioned in your tags, I would like to suggest a pure client-side approach, using Web storage. This approach is more universal (as soon as JavaScript is not disabled in the browser :-)), because it does not depend on what you have on the server side or if you have server side at all.

Please see: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API[^].

You can find a complete sample in this section my article: JavaScript Calculator, 7. Dynamic Strict Mode Switching and Web Storage.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900