I need to create a function that redirects to a different page depending on the value in the query string. This is for an asp.net web form page, and the function should be triggered when a cancel button (a devexpress button) is clicked.
function OnCancelClick(s, e) {
if (confirm('Leaving this page will require you to reselect benefits. Are you sure you want to leave?')) {
var callingPage = document.getElementById("<%= CallingPage.ClientID %>").value;
alert("Calling Page: " + callingPage);
if (callingPage == "AddEmployee.aspx") {
window.location.href = ResolveUrl('~/Member/Maintenance/AddEmployee.aspx?from=VerifyPage');
} else if (callingPage == "AddDependentMember.aspx") {
}
}
The ID of the hidden field in which I store the calling page information is called CallingPage. I set its value during page load, but I am encountering an error even before the page has finished loading, saying "The Controls collection cannot be modified because the control contains code blocks."