Hi,
private void BindColumnChart() { DataTable dt = new DataTable(); StringBuilder str = new StringBuilder(); try { var q = string.Empty; q = @"SELECT dbo.SubjectMaster.SubjectName ,dbo.QuestionPaper.Division ,dbo.QuestionPaperDetail.Marks FROM dbo.QuestionPaper INNER JOIN dbo.SubjectMaster ON dbo.QuestionPaper.SubjectId = dbo.SubjectMaster.SubjectId INNER JOIN dbo.QuestionPaperDetail ON dbo.QuestionPaper.QuestionPaperId = dbo.QuestionPaperDetail.QuestionPaperId WHERE (dbo.QuestionPaper.Semister = '1') AND (dbo.QuestionPaper.[Standard] = '9') GROUP BY dbo.SubjectMaster.SubjectName,dbo.QuestionPaper.Division,dbo.QuestionPaperDetail.Marks"; DataSet ds = SqlHelper.ExecuteDataset(ObjCnp.getConnect(), CommandType.Text, q.ToString(), null); dt = ds.Tables[0].Copy(); //------------------------------------------------------------------------------------- //List<string> result = new List<string>(); System.Collections.ArrayList result = new System.Collections.ArrayList(); foreach (DataRow dtrow in ds.Tables[0].Rows) { result.Add(dtrow); } str.Append(@"<script type='text/javascript'> google.load('visualization', '1', { packages: ['corechart'] }); function drawVisualization() { var data = google.visualization.arrayToDataTable([ // Create and populate the data table. // ['Subject', 'A', 'B', 'C', 'D', 'E', 'F'], // ['English', 50, 60, 70, 30, 80, 80], // ['Maths', 30, 50, 40, 30, 50, 80], // ['Science', 20, 50, 30, 80, 50, 90], // ['Hindi', 100, 20, 30, 80, 50, 30] ]); new google.visualization.ColumnChart(document.getElementById('visualization')). // Create and draw the visualization. draw(data, { title: 'Semister Marks Obtainded by Subject', width: 600, height: 400, hAxis: { title: 'Subject' } } ); } google.setOnLoadCallback(drawVisualization);</script>"); //var stringArr = dt.Rows[0].ItemArray.Select(x => x.ToString()).ToArray(); ct.Text = str.ToString().TrimEnd(',').Replace('*', '"'); } catch { } }
if i uncomment the array then it will work fine.
but i need to assing dynamic arrayToDatatable.
please anybody help me.....
thanks in advance.