2011-10-05 9 views
2

값을 Javascript로 전달할 때 문제가 발생합니다. pls help 값을 전달하는 것이 잘못되었습니다.asp.net의 JavaScript에 숨겨진 값을 전달하는 중 오류가 발생했습니다.

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(); 

나는 2 개 숨겨진 필드

<asp:HiddenField ID="hid_Percentage" runat="server" /> 
       <asp:HiddenField ID="hid_Color" runat="server" /> 

을 그리고 이것은 내가 뒤에 비율의 값이 전달

 double value = (read * 100/count); 
     string vProgressColor = "'#e01600'"; 
     hid_Percentage.Value = Convert.ToString(value); 
     hid_Color.Value = vProgressColor; 

asp.net 코드에 숨겨진 필드에 값을 전달하는 방법이다 그래프가 그 값을 사용하여 그려지는만큼 correctclty. 그러나 색은 짙은 색입니다. 색상이 나오지 않습니다.,

답변

1

코드에 아무런 문제가 없습니다. alert(color);을 두 번 확인해 보겠습니다. 색상이 인쇄되면 문제는 RGraph.VProgress에 있음을 의미합니다.

0

는 여기 의심 :

문자열 vProgressColor = " '#의 e01600을'";

제거 '당신의 문자열 값에서'시도

문자열 vProgressColor = "# e01600";

관련 문제