I am trying to call a Javascript function from my code, but I'm getting the Object Expected js error.
My call to the function:
ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type=\"text/JavaScript\">returnVal();</script>");
And my javascript from the .aspx
<script language ="javascript">
function returnVal() {
var hidAppID = document.getElementById("hidAppId");
var hidAppName = document.getElementById("hidAppName");
var hidAppSox = document.getElementById("hidAppSox");
if (window.showModalDialog) {
var sharedApp = {};
sharedApp.Id = hidAppID.value;
sharedApp.Name = hidAppName.value;
sharedApp.Sox = hidAppSox.value;
window.returnValue = sharedApp;
}
window.close();
}
</script>
The javascript is valid - I added a temporary button to the page to test an "onclicked" call to it. Unfortunately, I need to call it from the code.