Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
QuestionRegarding help www.paytm.com framework Pin
Aravin.it29-Aug-13 3:11
Aravin.it29-Aug-13 3:11 
AnswerRe: Regarding help www.paytm.com framework Pin
Richard MacCutchan29-Aug-13 3:23
mveRichard MacCutchan29-Aug-13 3:23 
QuestionRPC Server unavailable. Excel Process Pin
Mathumala_p29-Aug-13 0:38
Mathumala_p29-Aug-13 0:38 
AnswerRe: RPC Server unavailable. Excel Process Pin
Bernhard Hiller29-Aug-13 21:21
Bernhard Hiller29-Aug-13 21:21 
GeneralRe: RPC Server unavailable. Excel Process Pin
Mathumala_p29-Aug-13 21:28
Mathumala_p29-Aug-13 21:28 
QuestionAdd signature in MP3 file Pin
hamroush28-Aug-13 23:48
hamroush28-Aug-13 23:48 
AnswerRe: Add signature in MP3 file Pin
BillWoodruff29-Aug-13 3:36
professionalBillWoodruff29-Aug-13 3:36 
QuestionPostBack data lost ASP.NET 4.5 Pin
Paulo J Afonso28-Aug-13 23:47
Paulo J Afonso28-Aug-13 23:47 
Hi All

we are newbies on ASP and .NET, but with some experience on C# Big Grin | :-D .

We need some explanation about what we are doing wrong in this code and HTML page.

HTML Page
ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GraficosDados.aspx.cs" Inherits="Testing_Studies_GraficosDados" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        
    </div>
    </form>
</body>
</html>


C# Code
C#
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.DataVisualization.Charting;
using System.Data;

using Windwater;

public partial class Testing_Studies_GraficosDados : System.Web.UI.Page
{
    Chart C1 = new Chart();
    System.Web.UI.WebControls.CheckBoxList cbLengend = new CheckBoxList();
    SQLHelper SQL = new SQLHelper();
    IOHelper Log = new IOHelper();
    DataTable dt = new DataTable();

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadTable();
    }

    private void LoadTable() 
    {
        if (!IsPostBack)
        {
            string[] InValues = new string[] { "2013-08-26 00:00", "2013-08-28 23:59", "2", "50" };

            Log.OnInfo(string.Format("Begin={0}\tEnd={1}\tTT_Id={2}\tpggrel_id={3}", InValues[0], InValues[1], InValues[2], InValues[3]));
            dt = SQL.execStroredProcedures("EAPMSDAT", "wwGetDataForGraph", InValues);
            PopulateChart();
        }

    }

    private void PopulateChart()
    {
        string[] x = new string[dt.Rows.Count];
        double[][] y = new double[dt.Columns.Count][];

        for (int z = 1; z < dt.Columns.Count; z++)
        {
            y[z] = new double[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (z == 1)
                    x[i] = dt.Rows[i][0].ToString();
                y[z][i] = Convert.ToDouble(dt.Rows[i][z]);
            }
            C1.Series.Add(dt.Columns[z].ToString());
            C1.Series[z - 1].Points.DataBindXY(x, y[z]);
            C1.Series[z - 1].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.FastLine;
            C1.Series[z - 1].IsValueShownAsLabel = true;
            C1.Legends.Add(dt.Columns[z].ToString());
            C1.Legends[z - 1].Enabled = true;

            cbLengend.Items.Add(dt.Columns[z].ToString());
            cbLengend.Items[z - 1].Selected = true;
        }
        C1.Width = 2000;
        C1.Height = 800;
        C1.ChartAreas.Add("Testes");
        C1.ChartAreas["Testes"].Area3DStyle.Enable3D = false;

        form1.Controls.Add(C1);
        form1.Controls.Add(cbLengend);
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < cbLengend.Items.Count; i++)
        {
            C1.Series[i].Enabled = cbLengend.Items[i].Selected;
//            C1.Legends[i].Enabled = cbLengend.Items[i].Selected;
        }
    }
}


So on our solutions we don't want to call the stored procedure again, because they return 25k rows, over crosstab and mixed select, that take for first time around 5 seconds.

We define the DataTable dt = new DataTable(); for keep the data over all postback message we got from html, but is not working as we want. Also, for Chart and CheckBox.

can any give the path how to solve this?
Confused | :confused: Sigh | :sigh:
Thanks for any advice and any answer

Paulo Afonso

AnswerRe: PostBack data lost ASP.NET 4.5 Pin
Richard Deeming29-Aug-13 2:05
mveRichard Deeming29-Aug-13 2:05 
GeneralRe: PostBack data lost ASP.NET 4.5 Pin
Paulo J Afonso29-Aug-13 2:31
Paulo J Afonso29-Aug-13 2:31 
GeneralRe: PostBack data lost ASP.NET 4.5 Pin
Richard Deeming29-Aug-13 3:32
mveRichard Deeming29-Aug-13 3:32 
GeneralRe: PostBack data lost ASP.NET 4.5 Pin
Forbiddenx30-Aug-13 3:24
Forbiddenx30-Aug-13 3:24 
AnswerRe: PostBack data lost ASP.NET 4.5 Pin
Nelson Costa Inácio3-Sep-13 4:29
Nelson Costa Inácio3-Sep-13 4:29 
QuestionSMDR Data Collection using Tcp/ip in c# Pin
hamroush28-Aug-13 23:31
hamroush28-Aug-13 23:31 
QuestionRe: SMDR Data Collection using Tcp/ip in c# Pin
Richard MacCutchan29-Aug-13 0:31
mveRichard MacCutchan29-Aug-13 0:31 
AnswerRe: SMDR Data Collection using Tcp/ip in c# Pin
sep_exambo29-Aug-13 3:08
professionalsep_exambo29-Aug-13 3:08 
GeneralRe: SMDR Data Collection using Tcp/ip in c# Pin
Richard MacCutchan29-Aug-13 3:20
mveRichard MacCutchan29-Aug-13 3:20 
AnswerRe: SMDR Data Collection using Tcp/ip in c# Pin
NotPolitcallyCorrect29-Aug-13 2:06
NotPolitcallyCorrect29-Aug-13 2:06 
GeneralRe: SMDR Data Collection using Tcp/ip in c# Pin
Richard MacCutchan29-Aug-13 3:22
mveRichard MacCutchan29-Aug-13 3:22 
QuestionMATLAB Builder NE deployment problem Pin
shwetanisha28-Aug-13 20:23
shwetanisha28-Aug-13 20:23 
QuestionRe: MATLAB Builder NE deployment problem Pin
Richard MacCutchan28-Aug-13 21:28
mveRichard MacCutchan28-Aug-13 21:28 
AnswerRe: MATLAB Builder NE deployment problem Pin
shwetanisha28-Aug-13 21:55
shwetanisha28-Aug-13 21:55 
GeneralRe: MATLAB Builder NE deployment problem Pin
Richard MacCutchan28-Aug-13 22:11
mveRichard MacCutchan28-Aug-13 22:11 
GeneralRe: MATLAB Builder NE deployment problem Pin
shwetanisha29-Aug-13 0:15
shwetanisha29-Aug-13 0:15 
GeneralRe: MATLAB Builder NE deployment problem Pin
Richard MacCutchan29-Aug-13 0:29
mveRichard MacCutchan29-Aug-13 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.