Nel

Nel

  • NA
  • 716
  • 1.1m

Passing list of Sessions in Javascript

Feb 27 2015 1:39 PM

Hi,

I made a list of sessions in the cs code

 List<string> sessions=new List<string>();

 if(k==0)                         {                             Response.Write("02.25" + sectionList[0]);                             Session["sectionList"] = sectionList;                             sessions.Add((Session["sectionList"] as String)+ ",");                             k = 7;                         }                         else                          {                             Response.Write("02.25"+ sectionList[0] + sectionList[1]);                         Session[String.Format("sectionList{0}", k)] = sectionList; //form the sectionListnumber for that matching iners in ff file                         sessions.Add((Session[String.Format("sectionList{0}", k)] as String)+ ",");                         } ... ... Session["sessions"] = sessions;             if ((HttpContext.Current.Session["sessions"] as List<string>) != null)             {                 Response.Write(HttpContext.Current.Session["sessions"] as List<string>);             }//here I see that it is not null

in aspx I have

 var sessions='<%=Session["sessions"]%>';    //02.27             var sess=sessions.split(",");       ... ...    var lineStringi=[];             var spli=[];             var l=8;                                  for (var r=0;r<kmax;r++)                 {                     lineStringi[l]= sess[r].ToArray() ;                     spli[l-6]=lineStringi[l].split(',');                        var spl+String.Format("{0}", l) = lineString8.split(',');--%>                     l++;                     alert("spli[l-6]"+spli[l-6]);                  }

but I get that spli[l-6] Is undefined.

Can anybody help me please what I do wrong, how to pass and operate with the list of Sessions passed from the cs file?

Thanks



Answers (2)