473,763 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Redire ct 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 2118
"Rod" <ro**@newsgroup s.nospam> wrote in
news:uF******** ******@TK2MSFTN GP11.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********@rog ers.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**@newsgroup s.nospam> wrote in message
news:uF******** ******@TK2MSFTN GP11.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.Redire ct 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********@rog ers.com> wrote in message
news:Xn******** *************** ****@140.99.99. 130...
"Rod" <ro**@newsgroup s.nospam> wrote in
news:uF******** ******@TK2MSFTN GP11.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********@rog ers.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******@takem pis.com> wrote in message
news:uN******** ******@TK2MSFTN GP09.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**@newsgroup s.nospam> wrote in message
news:uF******** ******@TK2MSFTN GP11.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.Redire ct 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**@newsgroup s.nospam> wrote in news:#vyLcQ3iEH A.556
@tk2msftngp13.p hx.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
3435
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
4759
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 around chunks of data in DataTables/DataSets, simply because that was the format that they were in when the data was taken from the database. Now, I know this maybe a pretty silly question with a standard "it depends" answer, but I'm going to...
9
2299
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 receiving it, would that change the answer to the above?
3
2685
by: Marc Castrechini | last post by:
First off this is a great reference for passing data between the Data Access and Business Layers: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/Anch_EntDevAppArchPatPrac.asp I use my own classes in the Business layer. I want to keep the Data Access layer from requiring these classes so I tried passing a Datarow between the layers and it seems to work good for me. Constructing the datarow in the Class...
22
25602
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 compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
7
1904
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
2684
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
3306
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 object is a reference type? my code is not proving that. I have a web project i created from a web service that is my object: public class ExcelService : SoapHttpClientProtocol {
3
2443
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 thought passing by reference, your passing the address in memory. public bool DoSomething(ref byte data) { byte retVal = null; try
0
9389
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10003
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9828
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8825
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5271
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5410
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3529
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2797
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.