A comma separated string value is returned from DB and I would like to assign it to a javascript variable. Hidden fields are not an option. Unabele to get the data into js variable. This is what I have tried
ASPX:
<script>
var Collection = <%GetCodes();%>
$(document).ready(function () {
alert(Collection);
</script>
C#:
public string GetCodes()
{
datatable dt = function to get data;
return Convert.ToString(dt.Rows[0]["codes"]);
}
var Collection = '<%=GetCodes();%>';?