<head runat="server">
<title></title>>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
</head>;
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="lt" runat="server">
<div id="dashboard_div">
<div id="filter_div"></div>
<div id="chart_div"></div>
</div>;
</div>
</form>
</body>
my C# Code:-
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Text;
public partial class dashboard : System.Web.UI.Page
{
StringBuilder str = new StringBuilder();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
BindChart();
}
}
private DataTable GetData()
{
DataTable dt = new DataTable();
string cmd = "select YEAR,sales from area_chart";
SqlDataAdapter adp = new SqlDataAdapter(cmd, constr);
adp.Fill(dt);
return dt;
}
private void BindChart()
{
DataTable dt = new DataTable();
try
{
dt = GetData();
str.Append(@" <script type='text/javascript'>
google.load('visualization', '1.0', {'packages':['controls']});
google.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['YEAR','sales'],");
int count = dt.Rows.Count - 1;
for (int i = 0; i <= count; i++)
{
str.Append("['" + dt.Rows[i]["YEAR"].ToString() + "', " + dt.Rows[i]["sales"].ToString() + "],");
if (i == count)
{
str.Append("['" + dt.Rows[i]["YEAR"].ToString() + "', " + dt.Rows[i]["sales"].ToString() + "]]);}");
}
}
str.Append("var dashboard1 = new google.visualization.Dashboard(document.getElementById('dashboard_div'));");
str.Append("var yearslider = new google.visualization.ControlWrapper({ 'controlType': 'NumberRangeFilter', 'containerId': 'filter_div', 'options': { 'filterColumnLabel': 'YEAR' }});");
str.Append("var pieChart = new google.visualization.ChartWrapper({'chartType': 'PieChart','containerId': 'chart_div', 'options': { 'width': 300,'height': 300,'pieSliceText': 'value', 'legend': 'right' } });");
str.Append("dashboard1.bind(yearslider , pieChart);");
str.Append("dashboard1.draw(data);");
str.Append("</script>");
lt.Text = str.ToString();
}
catch
{
}
}
}
when e execute this error coming like this how can i solve
1)Microsoft JScript runtime error: 'google.visualization.Dashboard' is null or not an object
2)Microsoft JScript runtime error: 'google.visualization.ControlWrapper' is null or not an object
3)Microsoft JScript runtime error: 'dashboard1' is null or not an object
how can i sove these errors help me