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

Preferred way of passing data

Rod
I've written 2 ASP.NET applications (I've worked on one with a team and
another by myself). In my ASP.NET pages, when saving data to a backend
database I've done it by using the click event of a button and just using
the data during postback.

Now, however, I've got a WebForm that I'll be working on, and it is going to
collect more data than I have collected from the user in the past. I want to
be able to attempt to save each part and if any data element won't be saved,
then go ahead and continue processing the data until all of the entered data
is either saved or failed in the attempt. And then I wanted to inform the
user of the success and failure of trying to save each of the data elements.
Since there is more data now then before, I thought I would have to do what
I've seen done elsewhere on the Web and that is have the user enter all of
their data, press a button and go to some other page in order to save the
data as well as letting the user know the status of their trying to save the
data.

I've read of various ways of solving my problem:

Pass data from one WebForm to another WebForm by:
1) putting the data into the QueryString
2) putting the data into the Session object
3) putting the data the Context object's Items collection
I have also seen an article on MSDN titled "Passing Server Control Values
Between Pages" (
http://msdn.microsoft.com/library/de...tweenpages.asp )
..

And I have a book titled, "ASP.NET Unleashed: Second Edition" by Stephen
Walther (published by SAMS; ISBN: 0-672-32542-x) which says, "To take full
advantage of the ASP.NET framework, you should not create HTML forms that
post to a separate page. If a form posts to another page, any view state
maintained by the page is lost. ... The preferred method for working with
forms in the ASP.NET framework is to post forms back to the same page. ...
After you perform a postback, you can use the Response.Redirect method to
send a user a new page." (Appendix A, under the heading "Forms Should Post
Back to the Same Page", pp. 1361-1362.)

OK, now I am REALLY confused! I can accept and appreciate the fact that
there is more than one way to do whatever it is you want to do in ASP.NET.
What I would like to know is, what is the preferred way of handling a large
amount of data that you want to attempt to save and then report back to the
user the status of the attempt of saving. What is the "best practice", if
you will, of doing this?

Rod
Nov 18 '05 #1
5 2095
"Rod" <ro**@newsgroups.nospam> wrote in
news:uF**************@TK2MSFTNGP11.phx.gbl:
What I would like to know is, what is the preferred way of handling a
large amount of data that you want to attempt to save and then report
back to the user the status of the attempt of saving. What is the
"best practice", if you will, of doing this?


For large amounts of data, I would use a Session object.

Cookies and Query strings are limited in size. ViewState will degrade
performance because data has to travel back and forth between the client
and server, increasing the page payload.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
Think of all the various elements of ASP.Net as tools. Each has different
characteristics, and is best suited for certain types of purposes. Just as
with carpentry tools, there is no "best" tool, only the best tool for the
job at hand.

My advice is to get very familiar with all of the tools, what each one is
designed for, and the characteristics of each, so that you can make an
educated decision whenever you need to choose from a set of possible tools.
In any given situation, only ONE will be the best for the job at hand.

Your confusion stems from the fact that, while you have heard or read about
all of these tools, you don't yet have the intimate knowledge necessary to
make a choice between them. Spending some time familiarizing yourself fully
with them will not only answer your present question, but future ones as
well.

This approach takes more time (and work!) in the short run, but saves you
much more time in the long run.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Rod" <ro**@newsgroups.nospam> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
I've written 2 ASP.NET applications (I've worked on one with a team and
another by myself). In my ASP.NET pages, when saving data to a backend
database I've done it by using the click event of a button and just using
the data during postback.

Now, however, I've got a WebForm that I'll be working on, and it is going to collect more data than I have collected from the user in the past. I want to be able to attempt to save each part and if any data element won't be saved, then go ahead and continue processing the data until all of the entered data is either saved or failed in the attempt. And then I wanted to inform the
user of the success and failure of trying to save each of the data elements. Since there is more data now then before, I thought I would have to do what I've seen done elsewhere on the Web and that is have the user enter all of their data, press a button and go to some other page in order to save the
data as well as letting the user know the status of their trying to save the data.

I've read of various ways of solving my problem:

Pass data from one WebForm to another WebForm by:
1) putting the data into the QueryString
2) putting the data into the Session object
3) putting the data the Context object's Items collection
I have also seen an article on MSDN titled "Passing Server Control Values
Between Pages" (
http://msdn.microsoft.com/library/de...tweenpages.asp ) .

And I have a book titled, "ASP.NET Unleashed: Second Edition" by Stephen
Walther (published by SAMS; ISBN: 0-672-32542-x) which says, "To take full
advantage of the ASP.NET framework, you should not create HTML forms that
post to a separate page. If a form posts to another page, any view state
maintained by the page is lost. ... The preferred method for working with
forms in the ASP.NET framework is to post forms back to the same page. ...
After you perform a postback, you can use the Response.Redirect method to
send a user a new page." (Appendix A, under the heading "Forms Should Post
Back to the Same Page", pp. 1361-1362.)

OK, now I am REALLY confused! I can accept and appreciate the fact that
there is more than one way to do whatever it is you want to do in ASP.NET.
What I would like to know is, what is the preferred way of handling a large amount of data that you want to attempt to save and then report back to the user the status of the attempt of saving. What is the "best practice", if
you will, of doing this?

Rod

Nov 18 '05 #3
Rod
We are using the Session object for some things, and perhaps that is the
best way to go.

Rod

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"Rod" <ro**@newsgroups.nospam> wrote in
news:uF**************@TK2MSFTNGP11.phx.gbl:
What I would like to know is, what is the preferred way of handling a
large amount of data that you want to attempt to save and then report
back to the user the status of the attempt of saving. What is the
"best practice", if you will, of doing this?


For large amounts of data, I would use a Session object.

Cookies and Query strings are limited in size. ViewState will degrade
performance because data has to travel back and forth between the client
and server, increasing the page payload.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #4
Rod
My experience is rather limited; we've only used the Session object and the
QueryString. So, you are correct, I don't have experience with all of the
tools in the toolbox, to you user analogy (good analogy, I might add). I
was just hoping to gain from others experience, that is all.

Thank you, Kevin.

Rod

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Think of all the various elements of ASP.Net as tools. Each has different
characteristics, and is best suited for certain types of purposes. Just as
with carpentry tools, there is no "best" tool, only the best tool for the
job at hand.

My advice is to get very familiar with all of the tools, what each one is
designed for, and the characteristics of each, so that you can make an
educated decision whenever you need to choose from a set of possible tools. In any given situation, only ONE will be the best for the job at hand.

Your confusion stems from the fact that, while you have heard or read about all of these tools, you don't yet have the intimate knowledge necessary to
make a choice between them. Spending some time familiarizing yourself fully with them will not only answer your present question, but future ones as
well.

This approach takes more time (and work!) in the short run, but saves you
much more time in the long run.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Rod" <ro**@newsgroups.nospam> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
I've written 2 ASP.NET applications (I've worked on one with a team and
another by myself). In my ASP.NET pages, when saving data to a backend
database I've done it by using the click event of a button and just using the data during postback.

Now, however, I've got a WebForm that I'll be working on, and it is going
to
collect more data than I have collected from the user in the past. I
want to
be able to attempt to save each part and if any data element won't be saved,
then go ahead and continue processing the data until all of the entered

data
is either saved or failed in the attempt. And then I wanted to inform

the user of the success and failure of trying to save each of the data

elements.
Since there is more data now then before, I thought I would have to do

what
I've seen done elsewhere on the Web and that is have the user enter all of
their data, press a button and go to some other page in order to save

the data as well as letting the user know the status of their trying to save

the
data.

I've read of various ways of solving my problem:

Pass data from one WebForm to another WebForm by:
1) putting the data into the QueryString
2) putting the data into the Session object
3) putting the data the Context object's Items collection
I have also seen an article on MSDN titled "Passing Server Control Values Between Pages" (

http://msdn.microsoft.com/library/de...tweenpages.asp )
.

And I have a book titled, "ASP.NET Unleashed: Second Edition" by Stephen
Walther (published by SAMS; ISBN: 0-672-32542-x) which says, "To take full advantage of the ASP.NET framework, you should not create HTML forms that post to a separate page. If a form posts to another page, any view state
maintained by the page is lost. ... The preferred method for working with forms in the ASP.NET framework is to post forms back to the same page. .... After you perform a postback, you can use the Response.Redirect method to send a user a new page." (Appendix A, under the heading "Forms Should Post Back to the Same Page", pp. 1361-1362.)

OK, now I am REALLY confused! I can accept and appreciate the fact that
there is more than one way to do whatever it is you want to do in ASP.NET. What I would like to know is, what is the preferred way of handling a

large
amount of data that you want to attempt to save and then report back to

the
user the status of the attempt of saving. What is the "best practice", if you will, of doing this?

Rod


Nov 18 '05 #5
"Rod" <ro**@newsgroups.nospam> wrote in news:#vyLcQ3iEHA.556
@tk2msftngp13.phx.gbl:
We are using the Session object for some things, and perhaps that is the
best way to go.


Here's sort of a guide to help you:

If you want to bookmark the page: Querystring
If you're saving information for only one page: ViewState
If you want to save a large object over multiple pages: Session Variable
If you wish to tag a user over a prologed period of time: Cookies

Nov 18 '05 #6

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

Similar topics

41
by: Mountain Bikn' Guy | last post by:
What is the current preferred way to save user preferences in dotnet? Is the registry the right place to do this? Can anyone recommend a good article (or book) for this topic? Thanks.
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
9
by: Just Me | last post by:
PARAFORMAT2 is a structure that SendMessage will return stuff in. Is the "ref" correct or since only a pointer is being passed should it be by value? Suppose I was passing data rather then...
3
by: Marc Castrechini | last post by:
First off this is a great reference for passing data between the Data Access and Business Layers:...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
7
by: stabbert | last post by:
I am trying to setup a preferred export format for users when exporting data. Are there any pros/cons to using one format over another or is it really just personal preference? Spencer
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
3
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.