Karl Blackburn
asked on
Retrieve Hiddenfield Value after Javascript CHange
Hi,.
I am using Hiddenfields to push data from a webpage into the code behind, but have an issue as one field works and one doesn't.
The hiddenfields are
and the javascript is
and behind the scenes I am then using
It will quite happily pull the HFballoonadesc into the code behind after, but not HiddenFieldballoona - this will stay as whatever was loaded into it on page load.
Any ideas welcome?
Cheers
Karl
I am using Hiddenfields to push data from a webpage into the code behind, but have an issue as one field works and one doesn't.
The hiddenfields are
<asp:HiddenField ID="HiddenFieldballoona" runat="server" value="" />
<asp:HiddenField ID="HFballoonadesc" runat="server" value="" />
and the javascript is
function changeballoon(x,desc,rib)
{
document.getElementById('<%= HiddenFieldballoona.ClientID%>').value = "Balloon"+[x]+".png";
document.getElementById('<%= HFballoonadesc.ClientID%>').value = [desc];
}
and behind the scenes I am then using
HiddenFieldballoona.Value
It will quite happily pull the HFballoonadesc into the code behind after, but not HiddenFieldballoona - this will stay as whatever was loaded into it on page load.
Any ideas welcome?
Cheers
Karl
Are you sure values a,desc,rib are being passed to the function
If you change to text not hidden are the values inserted?
If you change to text not hidden are the values inserted?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
That does exactly the same thing, but when I try to pull from it code behind will always default to the original value when the page was loaded.
Just to clarify - once the page is rendered you can't access the ASP vars any more.
When you say "pull from the code behind" - where are you doing that?
ASKER
Managed to find the answer
ASKER
Its the
document.getElementById('<
That does exactly the same thing, but when I try to pull from it code behind will always default to the original value when the page was loaded.