Click here to Skip to main content
15,906,094 members
Home / Discussions / C#
   

C#

 
AnswerRe: In Windows Application how to create student marks memo Pin
Richard MacCutchan29-Aug-13 21:58
mveRichard MacCutchan29-Aug-13 21:58 
GeneralRe: In Windows Application how to create student marks memo Pin
Forbiddenx30-Aug-13 3:11
Forbiddenx30-Aug-13 3:11 
SuggestionRe: In Windows Application how to create student marks memo Pin
Richard MacCutchan30-Aug-13 3:25
mveRichard MacCutchan30-Aug-13 3:25 
GeneralRe: In Windows Application how to create student marks memo Pin
Forbiddenx30-Aug-13 3:44
Forbiddenx30-Aug-13 3:44 
GeneralRe: In Windows Application how to create student marks memo Pin
Richard MacCutchan30-Aug-13 5:06
mveRichard MacCutchan30-Aug-13 5:06 
AnswerRe: In Windows Application how to create student marks memo Pin
Abhinav S29-Aug-13 21:59
Abhinav S29-Aug-13 21:59 
AnswerRe: In Windows Application how to create student marks memo Pin
Dave Kreskowiak30-Aug-13 2:50
mveDave Kreskowiak30-Aug-13 2:50 
QuestionHand detection based on skin color using EmguCV Pin
Kh Ben29-Aug-13 7:01
professionalKh Ben29-Aug-13 7:01 
AnswerRe: Hand detection based on skin color using EmguCV Pin
OriginalGriff29-Aug-13 8:37
mveOriginalGriff29-Aug-13 8:37 
GeneralRe: Hand detection based on skin color using EmguCV Pin
Kh Ben29-Aug-13 9:09
professionalKh Ben29-Aug-13 9:09 
GeneralRe: Hand detection based on skin color using EmguCV Pin
OriginalGriff29-Aug-13 10:05
mveOriginalGriff29-Aug-13 10:05 
GeneralRe: Hand detection based on skin color using EmguCV Pin
Pete O'Hanlon29-Aug-13 10:08
mvePete O'Hanlon29-Aug-13 10:08 
GeneralRe: Hand detection based on skin color using EmguCV Pin
Kh Ben29-Aug-13 12:53
professionalKh Ben29-Aug-13 12:53 
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 
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 

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.