I have a few buttons that serve to hide or reveal other elements on the page when clicked.
The buttons are of the following format:
<button type="button" id="BTN" onclick="takeAction()">
The JavaScript is of the format:
<script type="text/javascript">
function takeAction() {
document.getElementById("ELEMENT1_HDR").style.display = "";
document.getElementById("ELEMENT1_BODY").style.display = "";
document.getElementById("ELEMENT2").style.display = "none";
document.getElementById("ELEMENT3").style.display = "none";
}
</script>
Locally, this works just fine when using strictly HTML and JavaScript, as well as when other features are using c# in the .aspx.cs files.
However, as soon as I publish it and access it via the ip address, clicking the buttons has no effect. When doing an Inspect Element and clicking on the button I receive the following error:
The value of the property 'takeAction' is null or undefined, not a Function object
What am I doing wrong that it works in my developing environment, but not in my simulated Prod environment?
I have tried putting the <script>
tag contents under the <header>
as well as <body>
tags to no variance on publishing. Could Visual Studio be corrupting it on publishing?
Somehow: When I start on page1 and click the "View" button to navigate to the specific record, the published version is loading the record view page to the screen but is keeping the page1 name. When done locally, it actually changes the page address - so that could be why the functions work locally but not in the published environment
I've selected a function that exists on both page1 and page2, called noCanDoYet()
which merely calls the alert function and posts to the screen the message: "This feature is not yet implemented". I get the same error for this function even though it is defined on both pages.
alert("help")
works though.
Could the following means of navigation to the specific record be causing issue in a Prod type environment that the local environment doesn't have?
protected void navigateView(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
setCurrentlySelectedRecord(lb.CommandArgument);
setViewEdit("View");
Server.Transfer("page2.aspx");
}