<%@ Page Language="VB" EnableViewState="true" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Dashboard from 1693 Analytics Powered by SpreadsheetGear using ASP.NET
<meta content="Dashboard from 1693 Analytics Powered by SpreadsheetGear, a royalty free Microsoft Excel compatible spreadsheet component for the Microsoft .NET Framework featuring the fastest and most complete calculation engine available. Create, read, modify, calculate and write Microsoft Excel workbooks from your Microsoft .NET, ASP.NET, C#, VB.NET and Microsoft Office solutions. Integrates with Microsoft Visual Studio .NET, including IntelliSense and Dynamic Help."
<script language="VB" runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Call routine to dynamically build the states.
' NOTE: Construct a url which references the SpreadsheetGear Image Rendering Utility
' which will return an image to be displayed in an image control.
' The name of the page containing the SpreadsheetGear Image Rendering Utility.
Dim imageRenderingUtility As String = "spreadsheetgearimageVB.aspx"
' The name of the workbook which contains the 1693 Analytics dasbboard.
Dim file As String = "?file=files/1693analytics.xls"
' The name of the worksheet which will be rendered.
Dim worksheet As String = "&worksheet=Template"
' The range which will be rendered by the image rendering utility
' which has been given a user defined name of "Dashboard".
Dim range As String = "&range=Dashboard"
' The currently selected state will be placed in
' the cell, which has been given a user defined name of
' "CurrentState", by the SpreadsheetGear Image Rendering Utility.
Dim value As String = "&CurrentState=" + ListState.SelectedValue
' Set the Image Url.
Dim url As String = imageRenderingUtility + file + worksheet + range + value
ImageMain.ImageUrl = url
End Sub 'Page_Load
' If page is loading for the first time...
If Not Page.IsPostBack Then
' Open the dashboard workbook.
Dim filename As String = Server.MapPath("files/1693analytics.xls")
Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook(filename)
' Dynamically build the state list using a defined name.
Dim stateRange As SpreadsheetGear.IRange = workbook.Names("ListOfStates").RefersToRange
Dim cell As SpreadsheetGear.IRange
For Each cell In stateRange
' Set the number of displayed rows to match the number of states.
ListState.Rows = ListState.Items.Count
' Select the first state.
ListState.SelectedIndex = 0
' Set the focus to the state list.
End Sub 'BuildStates
<body style="font-family: Verdana; font-size: small">
<form id="form1" runat="server">
<asp:Label ID="LabelTitle" Font-Size="Large" runat="server">Dashboard from 1693 Analytics - Powered by SpreadsheetGear and ASP.NET</asp:Label></td>
This sample shows how to create a dashboard where the user chooses from a list of
states, and relevant educational cost data and charts are returned for that state.
The model and data for this sample are contained in a static Excel workbook which
has been provided by Burt Baker at <a href="http://www.1693net.com/">1693 Analytics,
LLC</a>, but it could just as easily come from a workbook which is dynamically
generated by SpreadsheetGear.<br />
The key steps in the generation of this dashboard are:
<li>The first time this page is loaded, the BuildStates() method loads the workbook
from disk and populates the listbox of states from the range of cells which have
been given the defined name "ListOfStates".</li>
<li>The Page_Load() method constructs a URL which will instruct the image rendering
utility what to render.</li>
<li>The constructed URL is assigned to the Image control on this page.</li>
<li>The browser generates an HTTP request to the image rendering utility which generates
<asp:Label ID="LabelState" runat="server">State:</asp:Label></td>
<asp:Label ID="LabelImage" runat="server">Dashboard Generated by SpreadsheetGear Image Rendering Utility:</asp:Label></td>
<asp:ListBox ID="ListState" Width="100" Rows="8" AutoPostBack="true" runat="server">
<td width="742" height="895" valign="top">
<asp:Image ID="ImageMain" BorderStyle="Solid" BorderWidth="1" runat="server"></asp:Image></td>
Copyright 2009-2017 © SpreadsheetGear LLC. All Rights Reserved.<br />