I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.
I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..
I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.
Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.
I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.
I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.
initially I had
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);
I have tried putting the Currentcallout in not postback i.e.
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}
Any pointers would be welcome
thanks
Andycouple options...
both require that it be serialized
you can place it in the Page's viewstate...
private constant vs_callout="A";
protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}
...or place it in the session
}
"AAJ" wrote:
Quote:
Originally Posted by
Hi all
>
I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.
>
I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..
>
I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.
>
Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.
>
I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.
>
I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.
>
initially I had
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);
>
>
I have tried putting the Currentcallout in not postback i.e.
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}
>
>
Any pointers would be welcome
>
thanks
>
Andy
>
>
>
thanks David
"David Jessee" <DavidJessee@.discussions.microsoft.comwrote in message
news:CF0F5237-8616-4C4B-9DA9-252BA0946C1D@.microsoft.com...
Quote:
Originally Posted by
couple options...
both require that it be serialized
>
you can place it in the Page's viewstate...
>
private constant vs_callout="A";
>
protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}
>
...or place it in the session
}
>
>
>
"AAJ" wrote:
>
Quote:
Originally Posted by
>Hi all
>>
>I have some experience in 'Windows' programming but I am new to Web
>programming, I wonder if anyone can help.
>>
>I have a middle layer object that brings some data from a database class
>.
>The class reprsents a Callout, has lots of methods and properties and
>manages the business logic..
>>
>I then have a html page (GUI layer) that creates an instance of a
>callout,
>and from the callout object, it displays some textfields, labour etc plus
>some datagrids based on some collections it holds.
>>
>Everything works fine until the page refreshes, at which time the object
>seems to be destroyed and then recreated.
>>
>I want to keep the object alive with its existing data, on the server,
>and
>connect back to it , ie. not create a new object each time. I know I
>could
>use my Callouts WriteDate event to persist the data back to the
>SQLServer,
>and then just re load it, but this isn't what I really want. I would like
>to
>keep the object live until all work has been completed.
>>
>I have read a few things about sessions states etc, but don't really know
>where to start, and how to make the class persist.
>>
>initially I had
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>Currentcallout = new ExistingCallout(m_CalloutPK);
>>
>>
>I have tried putting the Currentcallout in not postback i.e.
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>if (!IsPostBack)
>{
>// first time
>Currentcallout = new ExistingCallout(m_CalloutPK);
>SetLabour();
>SetMaterials();
>}
>>
>>
>Any pointers would be welcome
>>
>thanks
>>
>Andy
>>
>>
>>
0 comments:
Post a Comment