Chart\Web Forms\ThinWeb\Postback Tool
Diagram\Web Forms\ThinWeb\Postback Tools
The postback tool allows you to initiate a page postback. Page postback renders the whole page contents and can be useful if you want to update the contents of several controls on the forms. The drawback is that it results in more traffic between the client and the server.
The following code snippets show how to send a postback when the user clicks on a chart or diagram element:
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, EventArgs e) if (!NThinChartControl1.Initialized){ // get the default chart // add bar serires to the chart chart.Series.Add(bar); // add one bar bar.FillStyle = new NColorFillStyle(Color.Blue); NPostbackTool postbackTool = new NPostbackTool(); NThinChartControl1.Controller.Tools.Add(postbackTool); } NThinChartControl1.Postback += new Nevron.ThinWeb.NPostbackEventHandler(NThinChartControl1_Postback); } void NThinChartControl1_Postback(object sender, Nevron.ThinWeb.NPostbackEventArgs e) { NThinChartControl chartControl = (NThinChartControl)sender; // hit test NHitTestResult hitTestResult = chartControl.HitTest(e.MousePosition.X, e.MousePosition.Y); NBarSeries bar = (NBarSeries)chartControl.Charts[0].Series[0]; if (hitTestResult.ChartElement == ChartElement.DataPoint) { bar.FillStyle = new NColorFillStyle(Color.Red); } } |
Nevron Diagram ThinWeb
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, EventArgs e) { if (!NThinDiagramControl1.Initialized) // init the document document.BeginInit(); NBasicShapesFactory factory = new NBasicShapesFactory(document); // apply interactivity // configure the controller NThinDiagramControl1.Postback += new Nevron.ThinWeb.NPostbackEventHandler(NThinDiagramControl1_Postback); } void NThinDiagramControl1_Postback(object sender, Nevron.ThinWeb.NPostbackEventArgs e) NThinDiagramControl diagramControl = (NThinDiagramControl)sender; int length = affectedShapes.Count; for (int i = 0; i < length; i++) NShape shape = affectedShapes[i] as NShape; if (shape != null) |
Chart\Web Forms\ThinWeb\Postback Tool
Diagram\Web Forms\ThinWeb\Postback Tools