|
-
Aug 13th, 2008, 04:02 AM
#1
Thread Starter
Hyperactive Member
Can't access textbox
Hi,
New to this so apologies in advance.
I am just trying to access a textbox and give it a value using this code:
Code:
<script type="text/javascript" language="javascript">
function FocusSelected()
{
document.getElementById('TextBox1').value = "hello"
return(true);
}
</script>
The problem is the text box is on a form view on a mutliview on a tab container and i think this is the reason the code does not find the text box. I get the following error: document.getElementById(...)' is null or not an object
Can anyone help?
Thanks
Mojo
-
Aug 13th, 2008, 02:26 PM
#2
Re: Can't access textbox
If it's ASP.NET you're using, you should stick to the ASP.NET forum as it has its own 'quirks'.
In your case, I am guessing that the actual rendered ID of the textbox control is not TextBox1. Do a view source and see for yourself. You will need to generate the call to the function in the codebehind or generate the javascript in the codebehind, because that's where you have access to the .ClientID property. (TextBox1.ClientID)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|