3
Answers

Dynamically naming the Session in aspx file

Nel

Nel

9y
653
1

Hi,

I want to dynamically give the names of the Sesions in the aspx file, depending on the current number of files in certain folder

Here is my try

 var kmax='<%= Session["kmax"] %>';

            if(kmax>1)
            {
                var l=2;
                for (var t=8;t<kmax+8;t++)
                {
                    var lineString+String.Format("{0}", t) = '<%= String.Join(",",(Session[String.Format("{0}",t)] as List<String>).ToArray()) %>';
                    var spl+String.Format("{0}", l) = lineString8.split(',');
                    l++;
                }
            }

but on the bold t in this code I get a message that it is not recognized in the current context and it is underlined with red color

Can anybody help me how to do this?
Thank you

Answers (3)