如何提高Microsoft Chart Control的Click事件?

时间:2012-01-13 19:17:06

标签: c# event-handling onclick

http://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.chart.click.aspx

事件处理程序:

protected void Chart1_Click(object sender, ImageMapEventArgs e)
{
        //stuff
}

我想手动举起这个活动。

public ActionResult HistoricalDrillDown(int reportID, string postBackValue)
{
    string sessionKey = string.Format("HistoricalReport: {0}", reportID);
    LineChart lineChart = (LineChart)Session[sessionKey];

    ImageMapEventArgs imageMapEventArgs = new ImageMapEventArgs(postBackValue);
    //Raise lineChart.Click() using ImageMapEventArgs
}

我觉得我非常接近 - 我只是不确定如何使用ImageMapEventArgs广播事件。任何人吗?

由于

1 个答案:

答案 0 :(得分:1)

您应该将代码移动到单独的方法,并从处理程序中调用该方法。

直接调用事件处理程序是不好的做法。