0

I have an asp hidden Value field:

<asp:HiddenField Value="" ID="TitleViewerHiddenValue" OnValueChanged="TitleViewerHiddenValue_ValueChanged" />

I have a javascript event:

function setHiddenValue()
{
     var x = document.getElementById('<%=TitleViewerHiddenValue.ClientID %>');
     x.textcontent = "HELLO WORLD"; // I feel this is wrong
}

How do I fix the javascript function so i can set the value of the hidden field and trigger the OnValueChanged event on the server?

Spock
  • 7,009
  • 1
  • 41
  • 60
fifamaniac04
  • 2,343
  • 12
  • 49
  • 72

1 Answers1

0
x.value

It's a form element, not a display element.

For triggering the change event, see How can I trigger an onchange event manually?

Though I think if you're doing all of this to trigger ASP's built in stuff, you're trying to build a house out of duct tape.

Community
  • 1
  • 1
Dan Heberden
  • 10,990
  • 3
  • 33
  • 29
  • I realize it's kind of a hack way to do it but I just need it to work right now. I'm still not hitting my breakpoint on the server for the C# handle though, is there something that i'm missing? – fifamaniac04 Oct 07 '13 at 14:59