How to pass javascript variable to asp code with ASP.NET MVC
- by Bolu
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.