473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Persistance

I have some classes that contain my objects...say..... Client...with all his
properties, Methods & Events. I use this on my web pages like this.
Dim MyClient as New Client(IdCorporation)

This because I need the information of that client as a reference.

Then I use:

If not page.IsPostBack then

Dim MyOtherClient as New Client ()
This is created just to use a function from that class:
MyOtherClient.Add (Name, Address, City, Zip, Phone)

Endif

The problem is that when a postback occurs...MyOtherClient = MyClient.

How should this be handled?

Thanks
Nov 21 '05 #1
3 932

"CCORDON" <tc******@hotmail.com> wrote
I have some classes that contain my objects...say..... Client...with all his
properties, Methods & Events. I use this on my web pages like this.

Dim MyClient as New Client(IdCorporation)

This because I need the information of that client as a reference.

Then I use:

If not page.IsPostBack then

Dim MyOtherClient as New Client ()
This is created just to use a function from that class:
MyOtherClient.Add (Name, Address, City, Zip, Phone)

Endif

The problem is that when a postback occurs...MyOtherClient = MyClient.

How should this be handled?

What you posted seems impossible, no where are the two related to eachother
in your posted code. Perhaps you need to show more of what you are using....

LFS
Nov 21 '05 #2
Here is the code. Thank you for your help

Imports Vivo.DBAccess

Public Class CorporacionesMod

Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Protected WithEvents lblUserInfo As System.Web.UI.WebControls.Label

Protected WithEvents cmdLogOff As System.Web.UI.WebControls.ImageButton

Protected WithEvents RequiredFieldValidator2 As
System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents txtNombre As System.Web.UI.WebControls.TextBox

Protected WithEvents cmdSave As System.Web.UI.WebControls.Button

Protected WithEvents ValidationSummary1 As
System.Web.UI.WebControls.ValidationSummary

'NOTE: The following placeholder declaration is required by the Web Form
Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Shared objCorporacion As Corporacion

Private Shared MyUser As New User

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

If Session("LoggedOn") = False Then

Response.Redirect("../UserLogin.aspx")

Exit Sub

End If

MyUser = CType(Session("User"), User)

Dim MyCorp As New Corporacion(MyUser.IdCorporacion)

lblUserInfo.Text = MyUser.NombreCompleto & "<BR>" & MyCorp.Nombre

If MyUser.Super = False Then

Response.Redirect("NoAccess.aspx")

End If

If Not (Page.IsPostBack) Then

objCorporacion = New Corporacion(Request.Params("IdCorporacion"))

txtNombre.Text = objCorporacion.Nombre

End If

End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click

Session("ResultMessage") = objCorporacion.Update(objCorporacion.ID,
txtNombre.Text)

Response.Redirect("Result.aspx?RedirectPage=Corpor aciones.aspx")

End Sub

Private Sub cmdLogOff_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles cmdLogOff.Click

Session("LoggedOn") = False

Session.Abandon()

Response.Redirect("../Gracias.aspx")

End Sub

End Class

Thanks,

"CCORDON" <tc******@hotmail.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
I have some classes that contain my objects...say..... Client...with all
his properties, Methods & Events. I use this on my web pages like this.
Dim MyClient as New Client(IdCorporation)

This because I need the information of that client as a reference.

Then I use:

If not page.IsPostBack then

Dim MyOtherClient as New Client ()
This is created just to use a function from that class:
MyOtherClient.Add (Name, Address, City, Zip, Phone)

Endif

The problem is that when a postback occurs...MyOtherClient = MyClient.

How should this be handled?

Thanks

Nov 21 '05 #3

"CCORDON" <tc******@hotmail.com> wrote
Here is the code. Thank you for your help


OK, how have you determined the problem?
The problem is that when a postback occurs...MyOtherClient = MyClient.


I did not see any assignment like that in the code you posted. The obvious
conclusion is that the two were not made equal to eachother, so I have to
ask, how are you determining that they are equal?

LFS
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kasper K | last post by:
Hi, I'm using PHP with apache. From what I understand, global variables are only global to one php script (i.e. the file and all the files it includes), but they are not persisted between...
6
by: Hal Vaughan | last post by:
Being self taught, this is one thing I've always had trouble with -- I finally get it straight in one situation and I find I'm not sure about another. I have a class that keeps calling an...
1
by: Francois Meehan | last post by:
Hi all, I am looking for a small DB solution for object persistence (mostly shelve object). I need it to: Works both in Linux and windoze Server independent (no Mysql or the like) Allow...
4
by: Chris S. | last post by:
I'm trying to write programs that make use of a lot of dynamic structures. To aid in debugging and data extraction, I'd like to persist these objects in a form that's readable, but one that also...
3
by: Gonzalo Sainz-Trápaga (GomoX) | last post by:
Hi, I've posted this to mod_python@modpython.org and got no answers, so i'm reposting it here, I really hope someone can help me out. ------ Hi, I'm building my first application with...
0
by: Todd | last post by:
I'm having trouble porting something from VB 6.0 with MSXML 4.0 to C# and the .Net framework. Using MSXML 4.0, I use the HTTPRequest object to get the following page and obtain a list of...
2
by: Leo | last post by:
Hi, I'm back to ASP for a short while and I was wondering how I could save the entire Application/Session-state to a file or database and how to read it back afterwards. I'd like to preserve...
0
by: Michael.McD | last post by:
Is there any consensus on the way to go when implementing object persistance to a dB? For example MHibernate v. DataObjects (x-tensive). Cheers, Michael McD
2
by: Kiran | last post by:
Hi, This is something weird I noticed recently in ASP.Net. I have created typed dataset and I have filled the data. when a postback happens, the data of the dataset is lost. Is there a...
45
by: bigdadro | last post by:
I've created a new class using prototype.js. After I make the ajax.request all references to this.myClassMethodorVariable are lost. Does the ajax method blow out the object persistance? I'm fairly...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.