G
Guest
In the Page_Load() of my webForm, I have the following code, and on my HTML
button, the onclick button calls writeVal() (the javascript function). When
I click on the button, I see the messagebox from the Alert(), but the
server-side Textbox text is not set to 'TEST'. I get a javascript error
saying, "document.getElementById(...) is null or is not an object.". What
could the problem be? The textbox is inside a Wizard control. Here's the code:
protected void Page_Load(object sender, EventArgs e)
{
string scr2 = @"<script>
function writeVal()
{
alert('test');
document.getElementById('txt_name').innerText = 'TEST';
}
</script>";
Page.RegisterClientScriptBlock("writeVal", scr2);
}
I can only assume that the Textbox being inside the Wizard could be causing
the error. I'm using VS2005 v2.0
Thanks.
button, the onclick button calls writeVal() (the javascript function). When
I click on the button, I see the messagebox from the Alert(), but the
server-side Textbox text is not set to 'TEST'. I get a javascript error
saying, "document.getElementById(...) is null or is not an object.". What
could the problem be? The textbox is inside a Wizard control. Here's the code:
protected void Page_Load(object sender, EventArgs e)
{
string scr2 = @"<script>
function writeVal()
{
alert('test');
document.getElementById('txt_name').innerText = 'TEST';
}
</script>";
Page.RegisterClientScriptBlock("writeVal", scr2);
}
I can only assume that the Textbox being inside the Wizard could be causing
the error. I'm using VS2005 v2.0
Thanks.