DBDataSet.tblAdsDataTable dtAds = client.getAdsDate(ref errCode, AdsType, AdsSlot, Country);
string ss = "";
string aa = "";
if (dtAds.Rows.Count > 0)
{
foreach (DBDataSet.tblAdsRow dr in dtAds)
{
DateTime date = dr.AdsDate;
string AdsDate = date.ToString("dd/MM/yyyy");
ss += '"' + AdsDate + '"' +",";
aa = ss.TrimEnd(','); // equal to "01/01/2018","02/01/2018"
string jquery = "var naArray = ["+ aa +"];";;
ClientScript.RegisterStartupScript(typeof(Page), "a key","<script>" + jquery + "</script>");
}
}
Hi, from the code above, i would want to add javascript in code behind like <script> var naArray = ["01/01/2018","02/01/2018"];</script>. However, when i execute, it become <script> var naArray = ["01/01/2018"]; <script> which "02/01/2018" is missing in the array. Appreciate if anyone can help on this. Thanks.