Hi,
I have a UpdatePanel that includes a GridView and an asp:Literal object. After binding the GridView, I inject a javascript text in the Literal object.
literal.Text = "<script type=\"text/javascript\">" +
String.Concat("var CheckBoxIDs = new Array(", String.Join(",",(string [])arrList.ToArray(typeof(string))), ");") +
"</script>";
The javascript variable is used by other functions when the user clicks on checkboxes in the GridView.
But for some reason, the Literal value does not gets updated. After further troubleshooting, I found that it does not like the "<" character.
This works:
literal.Text = String.Concat("var CheckBoxIDs = new Array(", String.Join(",",(string [])arrList.ToArray(typeof(string))), ");") ;
But then how do I make this a page level javascript variable? Ideally I want to inject the script tag and the corresponding javascript within the script tags.
Am I missing something here? Is there any other way to update javascript variables dynamically on async postback?
Thanks
HP