update variable for charting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?bWFydGluMQ==?=

    #1

    update variable for charting

    I just use queryString ("image") to keep generated chart in the middle panel
    with top menu and bottom table when user select different chart varibale like
    Unit on the dropdownlist button and enter date on the textbox. The top panel
    is menu including dropdownlist button, textbox and submit button, the bottom
    panel is reference table called gvReference. When page is load, it shows
    menu, chart and reference table. Then when user select different chart
    variable like Unit and enter Date in the textbox and hit Submit, there are 2
    situations, one is if use queryString ("image") condition in the
    Button_click sub, it always show the old chart with menu and table (that
    means notuse new variable to draw chart), second is if no queryString
    ("image") condition, it shows only updated chart ( use new selected
    vaaibels to draw chart), but lost mean and reference table. So I want to
    keep top menu and table in the bottom and let new generated chart in the
    middle panel. In general, what I want is when user select varibles and hit
    submit, I want use new vabile to drawLineChart and display on the middle
    panel without losting top menu and table in the bottom. I spend long time
    and still get problem soloved, any suggestion and any new approach. Thanks
    so much in advance.

    1.CemsChart.asp x page for image part

    <%@ Page Language="VB" AutoEventWireup ="false" CodeFile="CemsC hart.aspx.vb"
    Inherits="CemsC hart"%>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML>

    <HEAD>

    <title>Cems Charting</title>

    <meta http-equiv ="refresh" content= "300" />

    </HEAD>

    <body >

    <form id="Form1" method="post" runat="server">


    <asp:Panel ID="Panel1" runat="server" Height="44px" Width="986px">



    <asp:Label ID="Label2" runat="server" Text="Select Unit: " Font-Bold="True"
    Font-Size="Small"></asp:Label>

    <asp:DropDownLi st ID="dplstUnit" runat="server" Width="141px">

    </asp:DropDownLis t>



    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Select Date:
    "></asp:Label>


    <asp:textbox id="tbDate" runat="server" Width="81px"></asp:textbox>
    </asp:Panel>

    <asp:Panel ID="Panel2" runat="server" Height="506px" Width="1100px">
    <asp:Image ID="Image3" runat="server"

    Width="1000px" Height="500px" AlternateText=" Cems Chart" ImageAlign="Mid dle"
    ImageUrl="CemsC hart.aspx?image =1">
    </asp:Image>
    </asp:Panel>

    <asp:Panel ID="Panel3" runat="server" Height="98px" Width="1000px">
    Reference Data
    <asp:GridView ID="gvReference " runat="server" CaptionAlign="T op"
    CellSpacing="1" >
    </asp:GridView>
    </asp:Panel>

    </form>
    </body>

    </HTML>

    ---------------------------------------------------------------------------------

    2. CemsChart.aspx. vb

    Imports System.Drawing

    Imports System.Drawing. Text

    Imports System.Drawing. Drawing2D

    Imports System.Drawing. Imaging

    Imports System.Data.Sql Client

    Public Class CemsChart Inherits System.Web.UI.P age

    Public strDate As String

    Public strFilename As String



    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    If Not IsPostBack Then

    tbDate.Text = Today

    'End If

    If Not IsPostBack Then

    strDate = tbDate.Text

    End If 'end postback

    '.'*** call menuTable ****

    Call PopulateListTab le()

    strFilename = dplstUnit.Selec tedValue

    If Request.QuerySt ring("image") = 1 Then 'second postback to call ?

    Call DrawLineChart(s trDate, strFileName)

    End If

    End Sub



    Protected Sub btnSubmit_Click (ByVal sender As Object, ByVal e As
    System.EventArg s) Handles btnSubmit.Click

    strDate = tbDate.Text

    '**** call PopulateListTab le************* *************** **

    Call PopulateListTab le()

    If Request.QuerySt ring("image") = 1 Then

    Call DrawLineChart(s trDate, strFilename)

    End If

    End Sub



    Public Sub PopulateListTab le() 'pupulate dplstUnit downloadlist and
    gvRefeence table

    //code here

    End Sub

    Public Sub DrawLineChart(B yVal title As String, ByVal subTitle As String,
    ByVal width As Integer, ByVal height As Integer, ByRef dt As DataTable, ByVal
    timeP As Integer, ByRef

    target As Stream)

    // code here

    End sub
Working...