ChartDirector 7.1 (.NET Edition)

Using Code-Behind Style in ASP.NET Web Forms


The ASP.NET Web Forms sample code that come with ChartDirector are in single file ASPX style (inline style). This allows the sample code to be distributed easily and can be executed without depending on any particular development tool. (Just copy the file to the web server.)

In inline style, both the HTML tags and the VB/C# code are stored in the ASPX file. The VB/C# code are in <script runat='server'> .... </script> tags in the ASPX file.

Visual Studio also supports a programming style known as code-behind. In this style, the ASPX file is mainly for the HTML tags, while the VB/C# code is in a separate file (aspx.vb or aspx.cs).

To convert the sample code to code-behind style, one simply needs to move the code from the <script runat='server'> .... </script> tags in the ASPX file to the code-behind file. The followings are the detail steps: