ActiveX ASP.NET
Posted: Mon Sep 22, 2008 9:23 am
Hello,
I need some help to use the AxtiveX object in my C# Website project. I doesn't seem to work. I can see the object when I run the project, but it loads with error, and it doesn't want to load the byte array accordingly?
This is my development environment:
OS: MS Windows XP Pro
Visual Studio 2005/2008
Teechart Version 7/8
Here is the code I use in my project:
Defualt.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>WebForm1</title>
<script language="VBScript">
Sub Window_Onload()
TChart1.Import.LoadFromURL("http://localhost/tee/GenGraph.aspx")
end sub
Sub TChart1_OnMouseMove(shftstate, x, y)
if Form1.TChart1.SeriesCount > 0 then
if x < Form1.TChart1.Axis.Right.Position and x > Form1.TChart1.Axis.Left.Position _
and y < Form1.TChart1.Axis.Bottom.Position and y > Form1.TChart1.Axis.Top.Position then
XVal = Round(Form1.TChart1.Series(0).XScreenToValue(x),2)
YVal = Round(Form1.TChart1.Series(0).YScreenToValue(y),2)
else
XVal ="none"
YVal ="none"
end if
Form1.TChart1.Repaint
end if
end sub
</script>
</head>
<body>
<form id="Form1" runat="server">
<div>
<OBJECT id="TChart1" style="Z-INDEX: 101; LEFT: 38px; WIDTH: 558px; POSITION: absolute; TOP: 179px; HEIGHT: 284px" type="application/x-oleobject" classid="clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E" name="TChart1" VIEWASTEXT>
<PARAM NAME="Base64" VALUE="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoAy4CBkhlaWdodAMcARBHcmFkaWVu
dC5WaXNpYmxlCRJUaXRsZS5UZXh0LlN0cmluZ3MBBghUZWVDaGFydAAAAAAAAAACAAAAAP////8=">
</OBJECT>
</div>
</form>
</body>
</html>
GenGraph.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TeeChart;
using System.IO;
public partial class GenGraph : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TeeChart.TChartClass TChart1 = new TeeChart.TChartClass();
TChart1.AddSeries(TeeChart.ESeriesClass.scBar);
TChart1.Series(0).FillSampleValues(10);
TChart1.Header.Text.Add("events in .NET example");
TChart1.Header.Font.Size = 10;
Response.BinaryWrite((byte[])TChart1.Export.asNative.SaveToStream(true));
}
}
Help with this will be appreciated.
Regards,
I need some help to use the AxtiveX object in my C# Website project. I doesn't seem to work. I can see the object when I run the project, but it loads with error, and it doesn't want to load the byte array accordingly?
This is my development environment:
OS: MS Windows XP Pro
Visual Studio 2005/2008
Teechart Version 7/8
Here is the code I use in my project:
Defualt.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>WebForm1</title>
<script language="VBScript">
Sub Window_Onload()
TChart1.Import.LoadFromURL("http://localhost/tee/GenGraph.aspx")
end sub
Sub TChart1_OnMouseMove(shftstate, x, y)
if Form1.TChart1.SeriesCount > 0 then
if x < Form1.TChart1.Axis.Right.Position and x > Form1.TChart1.Axis.Left.Position _
and y < Form1.TChart1.Axis.Bottom.Position and y > Form1.TChart1.Axis.Top.Position then
XVal = Round(Form1.TChart1.Series(0).XScreenToValue(x),2)
YVal = Round(Form1.TChart1.Series(0).YScreenToValue(y),2)
else
XVal ="none"
YVal ="none"
end if
Form1.TChart1.Repaint
end if
end sub
</script>
</head>
<body>
<form id="Form1" runat="server">
<div>
<OBJECT id="TChart1" style="Z-INDEX: 101; LEFT: 38px; WIDTH: 558px; POSITION: absolute; TOP: 179px; HEIGHT: 284px" type="application/x-oleobject" classid="clsid:FAB9B41C-87D6-474D-AB7E-F07D78F2422E" name="TChart1" VIEWASTEXT>
<PARAM NAME="Base64" VALUE="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoAy4CBkhlaWdodAMcARBHcmFkaWVu
dC5WaXNpYmxlCRJUaXRsZS5UZXh0LlN0cmluZ3MBBghUZWVDaGFydAAAAAAAAAACAAAAAP////8=">
</OBJECT>
</div>
</form>
</body>
</html>
GenGraph.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TeeChart;
using System.IO;
public partial class GenGraph : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TeeChart.TChartClass TChart1 = new TeeChart.TChartClass();
TChart1.AddSeries(TeeChart.ESeriesClass.scBar);
TChart1.Series(0).FillSampleValues(10);
TChart1.Header.Text.Add("events in .NET example");
TChart1.Header.Font.Size = 10;
Response.BinaryWrite((byte[])TChart1.Export.asNative.SaveToStream(true));
}
}
Help with this will be appreciated.
Regards,