How to pass javascript variable to asp code with ASP.NET MVC

Posted by Bolu on Stack Overflow See other posts from Stack Overflow or by Bolu
Published on 2010-05-27T15:13:27Z Indexed on 2010/05/27 15:21 UTC
Read the original article Hit count: 188

Filed under:
|
|
for(var i=0; i<<%=Model.Mydatalist.Count%>;i++)
{
//then I need to pass i to Mydatalist like Model.Mydatalist[i]

}

//var myJSdata="<%Model.Mydatalist["&i&"]%>"; is not working.. as system see i (i's value) as a string, and will throw exception: cannot convert string to int.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript