How to prevent a dropdownlist from postback or updating inside an updatepanel when button is clicked. I am doing this because i have java script to make ddl a searchable dropdow
Even though there is no full PostBack, everything inside the UpdatePanel still gets refreshed and so the DOM loses the elements that were modified with jquery.
You need to call the function that created the searchable dropdownlists after a async PostBack also.
<script type="text/javascript">
$(document).ready(function () {
createSearchDropDown();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
createSearchDropDown();
});
function createSearchDropDown() {
$(".chzn-select").chosen();
$(".chzn-select-deselect").chosen({ allow_single_deselect: true });
}
</script>
Write your javascript function in pageLoad event of javascript.
It will always be executed in postback as well as partial postbacks also.
Find below code for your functions
function pageLoad() {
//This will ensure your code will run all the time
CreateDropdown();
InitializeDatePickers();
AssignPlugins();
}