I have the following ASP.NET, javascript code:
var decPts = <%=currentDec.Survey.User.DecPts %>;
var locn = <%=currentDec.Survey.User.Location %>;
function sDPts(dn) {
return ((Math.round(dn * Math.pow(10, decPts)) / Math.pow(10,
decPts)).toFixed(decPts));
}
function update(decNumber) {
dojo.byId('debug1').innerHTML = "decPts = (" + decPts + ")";
dojo.byId('debug2').innerHTML = "Location = (" + locn + ")";
}
<asp:content>
<div id="debug1"></div>
<div id="debug2"></div>
</content>
I get the following:
decPts = (2) ---- correct
Location = (undefined) ---- not correct
DecPts and Location are columns in a SQL database record. DecPts is int and Location is string
If I rewrite the HTML as
<div id="debug1"></div></td>
<div id="debug2"><%=currentDec.Survey.User.Location %></div>
I get the correct answer, i.e.
decPts = (2)
US
What am I doing wrong ?