I'm trying to get the value of an asp.net variable to javascript. Firstly, i wanted to get the number of rows in my database using asp.net and entity framework. Here is the query:
getRowCountThmb = (from g in obj.thumbnailImages where g.instrumentItem.brand.name == stringInstrumentName && g.instrumentItem.model == stringInstrumentModel select g).Count();
And then, the retrieved row count will be passed on to the getRowCountThmb property which is like this(auto-implemented): public int getRowCountThmb { get; set; }. And after that, i will get the value of getRowCountThmb in javascript like this: var srcArray = "<%= getRowCountThmb %>";
The problem is, I have found out that the getRowCountThmb is not actually getting any row count in the database. The value is 0. Resulting to a NaN value in the javascript variable called scrArray. Kindly give advice or provide solutions for this.
0should not cause aNaN. And not getting any rows has nothing to do with javascript.