Seeking guidance on setting a JavaScript value from backend code. Here is the current JS code snippet:
gts.push(['google_base_offer_id', 'ITEM_PRODUCT_SEARCH_ID']);
My attempt involves using this line of code:
gts.push(['google_base_offer_id', document.getElementById("hidden").value]);
The markup contains a hidden value:
<asp:HiddenField ID="hidden" runat="server" />
In the backend OnPreRender event, I am assigning the value like so:
hidden.Value = product.ProductId.ToString();
While the value is properly set, viewing the source in the browser does not show the populated value. Is there an error in my approach? Can the value be populated in that manner? Appreciate any help, Laziale