0
我想在gridview中使用flash圖表。你可以看到我的代碼如下:我如何在gridview行中使用javascript
DataTable tbl = new DataTable();
tbl.Columns.Add("chart");
DataRow rw;
rw = tbl.NewRow();
rw["chart"] = @"<div id=""chart5Div""></div>
<script type=""text/javascript"">
var chart = new FusionCharts(""Charts/FCF_MSLine.swf"", ""ChId1"", ""500"", ""300"");
var strXml = ""<graph numdivlines='4' lineThickness='3' showValues='0' numVDivLines='10' formatNumberScale='1' rotateNames='1' decimalPrecision='1' anchorRadius='2' anchorBgAlpha='0' numberPrefix='$' divLineAlpha='30' showAlternateHGridColor='1' yAxisMinValue='800000' shadowAlpha='50' >"";
strXml += ""<categories >"";
strXml += ""<category Name='Jan' />"";
strXml += ""<category Name='Feb' />"";
strXml += ""<category Name='Mar' />"";
strXml += ""<category Name='Apr' />"";
strXml += ""</categories >"";
strXml += ""<dataset seriesName='Current Year' color='A66EDD' anchorBorderColor='A66EDD' anchorRadius='4'>"";
strXml += ""<set value='1127654' />"";
strXml += ""<set value='1226234' />"";
strXml += ""<set value='1299456' />"";
strXml += ""<set value='1311565' />"";
strXml += ""</dataset>"";
strXml += ""</graph>"";
chart.setDataXML(strXml);
chart.render(""chart5Div"");
</script>";
tbl.Rows.Add(rw);
GridView1.DataSource = tbl;
GridView1.DataBind();
我必須動態創建我的數據源。但是當頁面運行時,我可以在gridview中看到字符串值而不是我的圖表。但是圖表代碼在表格標籤之間正確運行。我如何在GridView中使用這些代碼?
KR