G
Guest
Hello
Can anyone tell me what is the best way to persist a complex object across postbacks in ASP.NET
eg
* I have a Person class with methods to edit the person's info
* I navigate to my ASP.NET page "person_edit.aspx?PersonID=5321
* On Page_Load...If Not IsPostback I instantiate the object based on the Request("PersonID")
* I bind form fields to the properties of the object
* I execute 1 or more subs to edit the person's info
q
* On every postback where data in the object is changed, do I need to re-instantiate the object in order to databind again
note: I understand I still have to databind again... what I don't know is... is this business of having my object destroyed and recreated half a dozen times the norm? or is is bad design practice
Techniques I've tried are putting the object in Session, or putting the object in ViewState
Both of these can be made to work to some degree.. though not all that well.. In certain cases
depending on the kind of change I make to my object, I wind up re-loading it into my Session o
ViewState variable ANYWAY... Plus, based on everything I read about performance and scalability
I should NOT be putting complex objects in EITHER Session OR ViewState
Can anyone please advise
Stateless programming stinks.
Can anyone tell me what is the best way to persist a complex object across postbacks in ASP.NET
eg
* I have a Person class with methods to edit the person's info
* I navigate to my ASP.NET page "person_edit.aspx?PersonID=5321
* On Page_Load...If Not IsPostback I instantiate the object based on the Request("PersonID")
* I bind form fields to the properties of the object
* I execute 1 or more subs to edit the person's info
q
* On every postback where data in the object is changed, do I need to re-instantiate the object in order to databind again
note: I understand I still have to databind again... what I don't know is... is this business of having my object destroyed and recreated half a dozen times the norm? or is is bad design practice
Techniques I've tried are putting the object in Session, or putting the object in ViewState
Both of these can be made to work to some degree.. though not all that well.. In certain cases
depending on the kind of change I make to my object, I wind up re-loading it into my Session o
ViewState variable ANYWAY... Plus, based on everything I read about performance and scalability
I should NOT be putting complex objects in EITHER Session OR ViewState
Can anyone please advise
Stateless programming stinks.