This is a problem because how can I reference the control in the code behind file if it has changed at runtime. Example:
In the aspx file I have the following control:
In my code-behind file I have the following code:
I also have a javascript routine that changes the value of the hidden variable if the enter key is pressed. It is:
I get an error that says:
Microsoft JScript runtime error: 'document.frmMain.EnterHit' is null or not an object
Can someone please point me in the right direction?
- VBRookie
In the aspx file I have the following control:
Code:
<input type="hidden" id="EnterHit" value="N" runat="server" />
In my code-behind file I have the following code:
Code:
protected System.Web.UI.HtmlControls.HtmlInputHidden EnterHit;
private void Page_Load(object sender, System.EventArgs e)
{
if (EnterHit.Value == "Y")
{
... some code here
}
}
I also have a javascript routine that changes the value of the hidden variable if the enter key is pressed. It is:
Code:
<script language=javascript>
function FindKey(){
if (event.keyCode == 13) {document.frmMain.EnterHit.value='Y';}
}
</script>
I get an error that says:
Microsoft JScript runtime error: 'document.frmMain.EnterHit' is null or not an object
Can someone please point me in the right direction?
- VBRookie