473,382 Members | 1,749 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,382 software developers and data experts.

Postback frustration... please advise

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.
Jul 21 '05 #1
1 1377
Hi Artifact,

Your object is not persistent in ASP.Net, it is destroyed everytime when
your page is sended back to the client.

The application belong to the server and static/shared classes as well as
the cach belong to the application. (Shared by all users).

So when you do not identify them in those (while it is than growing, without
that you are able to kill them in another way than using a timer mechanisme
in my opinion), you are sticked to the viewstate of the session.

I myself see at this moment no benefit of creating data classes in a aspnet
application. I think that a right selected dataset/datatable is the best
thing to use for that and set that in a session and as a bad alternative in
a viewstate.

Just my thought about this.

Cor
Jul 21 '05 #2

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

Similar topics

5
by: Matt | last post by:
I always see the term "postback" from ASP book, but I am not sure if I fully understand the meaning. Here's my understanding so far, please correct me if any mistakes. Here's a typical html...
3
by: Matthew Louden | last post by:
I want to know if the PostBack concept applies to HTML web-based forms, regardless of what programming technologies we use: For example, ASP, ASP.NET, Java, CGI, etc... PostBack means to send...
10
by: BlueDolphin | last post by:
I'm not sure if this is a question or more of a rant... but I'm looking for some input on this from other developers out there. How often has the following happened to you and how have you dealt...
5
by: Mark Rodrigues | last post by:
Hi Everyone, I have been fighting a problem for a while and I wonder if someone out there can help. This problem has been presented in a number of news postings previously but I am yet to see a...
5
by: Matthew Louden | last post by:
I created simple ASP.NET web application to test how AutoPostBack property in a web control works. I set AutoPostBack property to be true of a web control. When I run the application, here's the...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
1
by: artifact | last post by:
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...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.