Hi all i have code that reads from a DB and populates a string in the code behind
List<string> rows = new List<string>();
DataTable prods = common.GetDataTable("vStoreProduct", new string[] { "stpt_Name" }, "stpt_CompanyId = " + company.CompanyId.ToString() + " AND stpt_Deleted is null");
foreach (DataRow row in prods.Rows)
{
prodNames += "\"" + row["stpt_Name"].ToString().Trim() + "\",";
}
string cleanedNanes = prodNames.Substring(0, prodNames.Length - 1);
prodNames = "[" + cleanedNanes + "]";
This produces something like ["Test1","Test2"]
In javascript i have
var availableTags = '<% =prodNames %>';
alert(availableTags);
How can i access this like an array in javascript like
alert(availableTags[5]);
and get the full item at the given index.
Thanks any help would be great