Visual Mining contact us | site map | search

Products Solutions Resource Library Services Customers Partners Developers Company
Developers

NetCharts® Server: ASP.NET Toolkit getTable Example using C#

This example shows how to utilize the NetCharts Server ASP.NET Toolkit to add an HTML table generated by NetCharts Server to an ASPX page using C#.

Web Form

<%@ Register TagPrefix="ns" Namespace="NetChartsServer" Assembly="NetChartsServer" %>
<%@ Page language="c#" Codebehind="nswebtable.aspx.cs" AutoEventWireup="false" Inherits="cstoolkitexample.nswebtable" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>NetCharts Server .NET Toolkit - NSWebTable Control Example</title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<link REL="stylesheet" HREF="styles.css" TYPE="text/css">
</HEAD>
<body>
<p align="center"><a href="http://www.visualmining.com" target="vmwindow"><img border="0" src="images/start-page-illo2.jpg"></a></p>
<P><B>Information:</B><br>
The <I><B>NSWebTable</B></I> control is a custom control that developers can
"drag" onto a WebForm to represent a table from <STRONG>NetCharts Server</STRONG>.&nbsp;
By setting the properties of the <i><B>NSWebTable</B></i> control a developer
can quickly integrate a table without the need for an ASP Literal control or
coding.&nbsp; Table parameters can be sent via the <i>Variables</i> property of
the <I><B>NSWebTable</B></I> control.&nbsp; If more control over the table is
needed, consider using the <i>getTable</i> API function.&nbsp; Click <a href="getTable.aspx">
here</a> for a example.</P>
<P><b>Example:</b><br>
<ns:NSWebTable id="NSWebTable1" runat="server" Width="421" Project="Examples/Tables" TableFile="ColumnStyles.tbl"></ns:NSWebTable>
</P>
<p><b>Source Code:</b><br>
<span class="code">Hashtable hashTable = NSWebTable1.Variables;<br>
if (hashTable == null) {<br>
&nbsp;&nbsp;hashTable = new Hashtable();<br>
}<br>
hashTable.Add("tableCaption", "Example Table Using the NSWebTable Control");<br>
NSWebTable1.Variables = hashTable;</span></p>
</body>
</HTML>

Source Code

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace cstoolkitexample
{
/// <summary>
/// Summary description for nswebtable.
/// </summary>
public class nswebtable : System.Web.UI.Page
{
protected NetChartsServer.NSWebTable NSWebTable1;

private void Page_Load(object sender, System.EventArgs e)
{
Hashtable hashTable = NSWebTable1.Variables;
if (hashTable == null) {
hashTable = new Hashtable();
}
hashTable.Add("tableCaption", "Example Table Using the NSWebTable Control");
NSWebTable1.Variables = hashTable;
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}


© 2008 Visual Mining, Inc. All rights reserved.
1-800-308-0731 | info@visualmining.com | privacy statement | legal
15825 Shady Grove Rd., Suite 20, Rockville, MD 20850 USA

Quote: The National Research Exchange