Using JavaScript to Change Server-Side TextBox

Discussion in '.NET' started by ftbadolato, May 21, 2008.

  1. ftbadolato

    ftbadolato

    Joined:
    May 21, 2008
    Messages:
    1
    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;
     
    ftbadolato, May 21, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hazzard
    Replies:
    2
    Views:
    586
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  2. Natty Gur
    Replies:
    0
    Views:
    496
    Natty Gur
    Jul 22, 2003
  3. =?Utf-8?B?Vk1J?=

    Setting server-side textbox with javascript?

    =?Utf-8?B?Vk1J?=, Oct 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    820
    Mark Fitzpatrick
    Oct 9, 2006
  4. john22
    Replies:
    0
    Views:
    593
    john22
    Nov 6, 2007
  5. Jack
    Replies:
    4
    Views:
    207
    Phillip Windell
    Nov 26, 2003
Loading...

Share This Page