Katalogerna
PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 11021


Im using Gantt_Asp but everytime I modify a timeitem I have a postback and I lose my f1.dataset values Please note that this article refers to the GTP.NET
Jump to article- 2007-10-20 10:30:00 - Email plexityHide

Question


I'm using Gantt_Asp but everytime I modify a timeitem I have a postback and I lose my f1.dataset values

 

Answer

 

This is by design, the ASP.NET model is stateless and the SessionState is there to help you to handle that.

What you need to do is to, depending on your design criterias, is to cache the dataset you use and restore it for postback events. This is shown in the LetsBuild_ samples series available here http://www.plexityhide.nu/ajaxdemo/LetsBuild_ProjectPlanner.aspx

 

In short this is done like this:

 

    protected void Page_Load(object sender, EventArgs e)
    {
...

      if (Page.Session["loaded_proj"] == null || (bool)(Page.Session["loaded_proj"]) == false)
      {


 
 // OK, New user connect to your DB and fetch the data...


        f1.dataSet1.ReadXml(Page.MapPath(".\\App_Data\\project.xml"));
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        f1.dataSet1.WriteXml(ms);
        Page.Session.Add("thedata_proj", ms);
        Page.Session.Add("loaded_proj", true);
      }
      else
      {
 // Returning user, get the cached dataset rather than fetching it again
        System.IO.MemoryStream ms = Page.Session["thedata_proj"] as System.IO.MemoryStream;
        ms.Position=0;
        f1.dataSet1.ReadXml(ms);
      }
     
....
      }

 

 

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...