Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
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

Hi
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:
Code:
    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)

        Chart.Dispose()
        MyBitmap.Dispose()
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:

Code:
<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.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 06:42 AM
Putting dynamic data into columns rashley XSLT 2 December 21st, 2005 11:03 AM
Putting VBScript in an ASP.NET page jturlington ASP.NET 1.0 and 1.1 Basics 1 May 14th, 2005 09:00 PM



All times are GMT -4. The time now is 01:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.