Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 25th, 2009, 06:46 AM
Authorized User
Join Date: Apr 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Putting a dynamic chart and the dropdown control the drives it on the same page

I am planning to create a page in a web application that displays a customised chart. The data values for this chart will be drawn from a database. On the page, there will be a control such as a dropdownlist that controls which entries from the database are displayed in the chart.
The step I am struggling with is putting the dropdownlist and the outputted chart on the same page, so that the user can see the chart changing in response to the dropdownlist change.

To create the chart, I am using some code along the following logic:
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim MyBitmap As New Bitmap(100, 100)
        Dim Chart As Graphics = Graphics.FromImage(MyBitmap)

        Chart.DrawLine(Pens.Yellow, 0, 0, 100, 100)
        Chart.DrawLine(Pens.Red, 100, 0, 0, 100)
          'The chart drawing parameters are set by variables which take values from a database’	
        MyBitmap.Save(Response.OutputStream, Imaging.ImageFormat.Gif)

What I am not sure about is how to send the chart image to the page, so that it only forms part of the page. Looking around the web for examples, I have mostly found suggestions were the chart generation is placed in a separate “chart generator page”, which does nothing but create the chart image. In the main/target page, an <img> tag is then placed, with the image source being the chart generating page. Something like this:

<img src="ChartGeneratingPage.aspx" alt="xyz" />
However, I can’t get this to work for my scenario, as I’m not sure how to pass the selected value from the dropdownlist across to code in the separate page that creates the image. I do, however, also suspect that there is a simpler/cleverer way of achieving what I am looking for. For example, would it be possible to have the chart generation code in the target page –that is, the page where the chart is actually displayed, and where we have the dropdownlist control?

Any help would be much appreciated!

PS: I am aware of the new "Chart Controls" that are available for ASP.NET 3.5. However, the charts I need to generate are highly customised, so I don't think I will be able to do this with the Chart Controls.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Dynamic Organization chart subhasps8 ASP.NET 2.0 Professional 1 April 16th, 2008 03:55 AM
Dynamic Dropdown bullsb Classic ASP Professional 4 March 9th, 2007 07:42 AM
Putting dynamic data into columns rashley XSLT 2 December 21st, 2005 12:03 PM
Putting VBScript in an ASP.NET page jturlington ASP.NET 1.0 and 1.1 Basics 1 May 14th, 2005 09:00 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.