我c#
剛剛有一個按鈕,單擊時這樣做有一個firePie.aspx
頁面,傳遞參數
protected void Button1_Click(object sender, EventArgs e)
{
string cadenaValor, valores;
cadenaValor = "Audi(28%)','BMW(29%)','Mercedes(22%)" ;
valores = "28,29,22";
Response.Redirect("pieChart.aspx?values="+cadenaValor+"&valores="+valores);
}
的參數是逗號分隔值的字符串,我想這個值傳遞給piechart.aspx
所以在javascript
捕捉功能的參數和打印餅圖中,pieChart.aspx
代碼:
<body>
<canvas id="cvs" width="450" height="300">[No canvas support]</canvas>
<form id="frm" method="get" >
<script type ="text/javascript" >
var pie1 = new RGraph.Pie('cvs', ['<%=this.Request.QueryString["valores"]%>']);
pie1.Set('chart.radius', 100);
pie1.Set('chart.tooltips', ['<%=this.Request.QueryString["values"]%>']);
pie1.Set('chart.labels', ['<%=this.Request.QueryString["values"]%>']);
pie1.Set('chart.strokestyle', 'white');
pie1.Set('chart.linewidth', 5);
pie1.Set('chart.shadow', true);
pie1.Set('chart.shadow.blur', 10);
pie1.Set('chart.shadow.offsetx', 0);
pie1.Set('chart.shadow.offsety', 0);
pie1.Set('chart.shadow.color', '#000');
pie1.Set('chart.text.color', '#999');
var explode = 20;
function myExplode (obj)
{
window.__pie__ = pie1;
for (var i=0; i<obj.data.length; ++i) {
setTimeout('window.__pie__.Explode('+i+',10)', i * 50);
}
}
if (RGraph.isOld()) {
pie1.Draw();
} else if (navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) {
RGraph.Effects.Pie.RoundRobin(pie1);
} else {
/**
* The RoundRobin callback initiates the exploding
*/
RGraph.Effects.Pie.RoundRobin(pie1, null, myExplode);
RGraph.Effects.Pie.Implode(pie1);
}
</script>
</form>
</body>
QueryString["valores"]
不工作,如果我寫的origi nal字符串,我的意思是,28,29,22行var pie1 = new RGraph.Pie('cvs'...
它的工作原理,我認爲由於任何原因javascript
不能識別這個值,但QueryString["values"]
被正確捕獲。你能幫我嗎?
它應該被標記爲C#,ASPX .. –
增加了c#asp.net標籤 – psema4