ChartRegionClick not working(triggered) in my following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
using Syncfusion.Windows.Forms.Chart;
namespace SQL_ServerConn
{
public partial class _Default : System.Web.UI.Page
{
SqlConnection myConnection = null;
SqlDataAdapter SqlDA1;
ChartDataBindModel model1 = null;
DataTable data;
DataSet ds1;
string ConnectionString = "Server=!!!; Database=$$$; User Id=**; password=$$$";
protected void Page_Load(object sender, EventArgs e)
{
//Bind data to GridGroupingControl.
try
{
GetData();
}
catch (SqlException ex)
{
}
finally
{
}
}
private void GetData()
{
//To allow ASP.NET to use SQL Compact Server 3.5
//AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
try
{
myConnection = new SqlConnection(ConnectionString);
string query1 = "";
query1 = "select ROW_NUMBER() over(order by AC.AnalysisCode) as Id, isnull(AC.AnalysisCode,'Not Link') AnalysisCode,isnull(AC.Description,'Not Link') as Name ,count(*) As Total from podetail pd inner join POHeader ph on pd.Company =ph.Company and pd.ponum = ph.PONum inner join Part P on pd.Company=P.Company and pd.PartNum=P.PartNum inner join AnalysisCd AC on P.Company=AC.Company and P.Mtl_AnalysisCode=AC.AnalysisCode where pd.company='COMP01' group by AC.Description,AC.AnalysisCode having count(*)> 5";
SqlCommand SqlCmd1 = new SqlCommand(query1, myConnection);
myConnection.Open();
SqlDA1 = new SqlDataAdapter(SqlCmd1.CommandText, myConnection);
ds1 = new DataSet();
DataTable dt = new DataTable("ChartSeries");
SqlDA1.Fill(dt);
data = dt;
this.model1 = new ChartDataBindModel(dt);
this.model1.XName = "ID";
this.model1.YNames = new string[] { "Total" };
ChartSeries series1 = new ChartSeries("Series1");
series1.Text = series1.Name;
series1.Type = ChartSeriesType.Pie;
series1.SeriesModel = this.model1;
this.ChartWebControl1.Series.Add(series1);
this.ChartWebControl1.ChartRegionClick += new Syncfusion.Web.UI.WebControls.Chart.ChartWebRegionMouseHandler(ChartWebControl1_ChartRegionClick);
// this.ChartWebControl1.ChartRegionClick += new Syncfusion.Web.UI.WebControls.Chart.ChartWebRegionMouseHandler(ChartWebControl1_ChartRegionClick);
}
catch (SqlException ex)
{
throw ex;
}
catch (Exception ex)
{
throw ex;
}
}
void ChartWebControl1_ChartRegionClick(object sender, Syncfusion.Web.UI.WebControls.Chart.ChartWebRegionMouseArgs e)
// void ChartWebControl1_ChartRegionClick(System.Object sender, Syncfusion.Web.UI.WebControls.Chart.ChartWebRegionMouseArgs e)
{
int Poi = Convert.ToInt32(e.PointIndex);
string Fstr = null;
string Fstr1 = null;
Fstr = "id=" + e.PointIndex + 1;
DataRow[] drow;
if (data.Select(Fstr).Length > 0)
{
drow = data.Select(Fstr, "AnalysisCode ASC");
Fstr1 = drow[0].ItemArray[1].ToString();
}
Console.Write(Fstr1.ToString());
try
{
SqlConnection con = new SqlConnection(@"Server=!!!; Database=###; User Id=@@; password=$$");
DataSet dSet = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select p.company,p.ponum as orderNum, p.orderdate,v.name as supplier,p.shipcountry as country, Pr.Duedate as DeliveryDate, p.fob as Mode,p.termscode as terms,P.ShipName, (p.shipaddress1+ ',' + P.ShipAddress2 + ',' + ShipCity + ',' +ShipZIP ) as Deliverat, p.entryperson as Createdby,(p.shipaddress1 + ',' + P.ShipAddress2 + ',' + ShipCity + ',' + ShipZIP ) as Address, p.character01 as comments,p.approvalstatus,pr.ContainerID,Pr.TranType,P.CurrencyCode,P.ExchangeRate,pl.ponum,pl.poline as sno,pl.Partnum, pl.linedesc as Description, pl.ium as UOM,pl.orderqty as Qty,pl.xorderqty,Pl.unitcost as Rate,pl.docunitcost,pl.unitcost , (pl.orderqty * pl.unitcost) As Value1,(pl.orderqty * pl.docunitcost)As Value2,(Select currDesc from Currency where Company=P.company and BaseCurr=1 ) As curr1, (Select currDesc from Currency where Company=P.company and CurrencyCode=P.CurrencyCode ) As curr2 from podetail pl ,Porel Pr,poheader p, vendor v, Part Prt, AnalysisCd A where p.company = pl.company And p.company = pr.company And P.company = v.company and P.Ponum=pl.ponum and P.ponum=pr.ponum and Pl.poline=pr.poline and p.vendornum=v.vendornum and pl.company=Prt.company and A.Company = Pl.Company and Prt.PartNum=pl.Partnum and A.AnalysisCode = Prt.Mtl_AnalysisCode and A.AnalysisCode ='" + Fstr1 + "' and P.company in ( 'COMP01')", con);
DataTable td;
da.Fill(dSet);
td = dSet.Tables[0];
GridGroupingControl1.DataSource = td;
GridGroupingControl1.DataBind();
con.Close();
}
catch (SqlException ex)
{
}
finally
{
}
}
}
}