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

C#

 
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 
AnswerRe: PostBack data lost ASP.NET 4.5 Pin
Richard Deeming29-Aug-13 2:05
mveRichard Deeming29-Aug-13 2:05 
You need to read the ASP.NET Page Life Cycle[^]. In particular, note that a new instance of the page class is created to serve each request. Field values will not be preserved between the initial request and the post-back request. Dynamically created controls must be re-created on every request.

If you want to keep the DataTable alive across requests, you'll need to store it in the Session or the Cache. However, since you say it contains 25K rows, this will put a lot of memory pressure on the server, and could lead to other problems.

C#
private void Page_Init(object sender, EventArgs e)
{
    // Recreate the dynamic controls in the Init event 
    // instead of the Load event to allow state to be preserved.
    LoadTable();
}

private DataTable LoadChartData()
{
    // This key needs to be unique across your application:
    const string cacheKey = "Testing_Studies_GraficosDados:ChartData";
    
    // Using the Cache, since the data doesn't seem to vary between users:
    var result = (DataTable)Cache[cacheKey];
    if (result == null)
    {
        string[] InValues = new string[] { "2013-08-26 00:00", "2013-08-28 23:59", "2", "50" };
        
        var log = new IOHelper();
        log.OnInfo(string.Format("Begin={0}\tEnd={1}\tTT_Id={2}\tpggrel_id={3}", InValues[0], InValues[1], InValues[2], InValues[3]));
        
        result = SQL.execStroredProcedures("EAPMSDAT", "wwGetDataForGraph", InValues);
        
        Cache.Add(cacheKey, result, 
           /* dependencies: */ null, 
           /* absoluteExpiration: */ DateTime.UtcNow.AddMinutes(5), 
           /* slidingExpiration: */ Cache.NoSlidingExpiration, 
           /* priority: */ CacheItemPriority.High, 
           /* onRemoveCallback: */ null);
    }
    
    return result;
}

private void LoadTable()
{
    DataTable dt = LoadChartData();
    PopulateChart(dt);
}

private void PopulateChart(DataTable dt)
{
    var C1 = new Chart();
    var cbLengend = new CheckBoxList();
    ...
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


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 
GeneralRe: MATLAB Builder NE deployment problem Pin
shwetanisha29-Aug-13 2:03
shwetanisha29-Aug-13 2:03 

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.