I would like to know how I can set a javascript value from my backend code.
I have this line of JS code:
gts.push([ 'google_base_offer_id', 'ITEM_PRODUCT_SEARCH_ID']);
What I am trying at this moment is:
gts.push(['google_base_offer_id', document.getElementById("hidden").value]);
I have hidden value set in the markup:
<asp:HiddenField ID="hidden" runat="server" />
and in the backend code, OnPreRender event, I am doing this:
hidden.Value = product.ProductId.ToString();
The value gets set properly but when I am viewing source in the browser the value is not populated.
Am I doing something wrong, is it possible to populate the value like that?
Thanks in advance, Laziale
You should be able to do it like: