Hi, I am using Asp.net MVC and in the controller I have a function that generates a list of array i.e. List and after converting it to a view I am returning this to the view page.In the view page I am converting it to List by the following code:
<% List<string[]> items = (List<string[]>)ViewData["Items"]; %>
Now I want to access the elements one by one of each array belonging to the list using for/foreach statement in the javascript.I am trying the following code:
var j;
for(j=0;j<'<%=items.Count%>';j++)
{
alert('<%=items['+j+'].GetValue(0).ToString()%>');
..........
}
But, I am getting the error : "Too many characters in character literal".If I use the following code then it is working fine:
alert('<%=items[0].GetValue(0).ToString()%>');
But I want to use it dynamically.Is there any way to do this operation?Please Help me.Thanks in advance. Arka