Problem with passing values to Javascript, am I going wrong in passing the value pls help.
var percentage= parseInt(document.getElementById("<%=hid_Percentage.ClientID%>").value);
var color = document.getElementById("<%=hid_Color.ClientID%>").value;
var progress1 = new RGraph.VProgress('progress1', percentage, 100);
progress1.Set('chart.colors', [color]);
progress1.Set('chart.tickmarks', false);
progress1.Draw();
I have 2 hidden fields
<asp:HiddenField ID="hid_Percentage" runat="server" />
<asp:HiddenField ID="hid_Color" runat="server" />
And this is how I pass value to the hidden field in code behind in asp.net
double val开发者_如何学JAVAue = (read * 100 / count);
string vProgressColor = "'#e01600'";
hid_Percentage.Value = Convert.ToString(value);
hid_Color.Value = vProgressColor;
The value for percentage is passed correclty as the graph is drawn using that value. But the color is emply. it is not getting the color.,
There is nothing wrong with your code. I would put an alert(color);
to double check. If you get the colour printed out, it means the problem is in the RGraph.VProgress
.
I doubt here:
string vProgressColor = "'#e01600'";
try removing ' ' from your string value
string vProgressColor = "#e01600";
精彩评论