Using JavaScript to Change Server-Side TextBox

Joined
May 21, 2008
Messages
1
Reaction score
0
I have the following TextBox on my .aspx page.

<asp:TextBox ID="hdnresultbox" Style="z-index: 101; left: 520px; position: absolute;
top: 632px" runat="server" Width="1px" Height="1px" ReadOnly="false">no</asp:TextBox>

The JavaScript from viewing the source is as follows. There is some JS above what you see here, but it is working fine. I also have a try...catch around all of this. The error that occurs is [object Error] and it occurs on the lines below when I attempt to set the value of the text box. The text box is on the page, but I am thinking it may have something to do with the runat="server" in the code above. I need that though b/c I check the field in my code-behind file as well. I need help on updating the value of this field via JavaScript.

if(result == true){
document.getElementById('aspnetForm._ctl0_ContentPlaceHolder1_hdnresultbox').value='yes';
}else{
document.getElementById('aspnetForm._ctl0_ContentPlaceHolder1_hdnresultbox').value='no';
}

return result;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top