473,748 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ViewState - urgent help needed!

The way I've built my page is to take the user through a multi-form process,
only rendering those controls that are needed for each section. The
ViewState is working the way I want it to, remembering items across the
process, back and forth. But when the user finally opts to complete the
sections and commit the information for processing, I can't access any of
the information that was not rendered on the last section. It's obviously
in the ViewState, since the page remembers the value, but I can't figure out
how to read those values.

The controls I am trying to get the values for are databound controls. I
don't know if this makes a difference or not.
Nov 19 '05 #1
4 1322
Random:
Depending on how this was done, you likely have to rebuild all the controls
in order to get their value. You mentioned that they are all databound, so
this is particularly true. While viewstate maintains the values, it doesn't
assign them to controls unless they exist. When the final "save" is
clicked, only the last form exists and thus it's the only one the page can
repopulate from the viewstate...all forms would need to be recreated in
order for the page to repopulate their value and have you access them.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Random" <ci*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
The way I've built my page is to take the user through a multi-form process, only rendering those controls that are needed for each section. The
ViewState is working the way I want it to, remembering items across the
process, back and forth. But when the user finally opts to complete the
sections and commit the information for processing, I can't access any of
the information that was not rendered on the last section. It's obviously
in the ViewState, since the page remembers the value, but I can't figure out how to read those values.

The controls I am trying to get the values for are databound controls. I
don't know if this makes a difference or not.

Nov 19 '05 #2
That's what I was afraid of. And the page won't let me rebuild server
controls with the same ID because they already exist. How pitiful.

Geez, and ASP.NET is supposed to cut down on development time. This is
taking me five times as long as it would have in classic ASP, just because
of the workarounds.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:er******** ******@TK2MSFTN GP11.phx.gbl...
Random:
Depending on how this was done, you likely have to rebuild all the
controls
in order to get their value. You mentioned that they are all databound,
so
this is particularly true. While viewstate maintains the values, it
doesn't
assign them to controls unless they exist. When the final "save" is
clicked, only the last form exists and thus it's the only one the page can
repopulate from the viewstate...all forms would need to be recreated in
order for the page to repopulate their value and have you access them.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Random" <ci*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
The way I've built my page is to take the user through a multi-form

process,
only rendering those controls that are needed for each section. The
ViewState is working the way I want it to, remembering items across the
process, back and forth. But when the user finally opts to complete the
sections and commit the information for processing, I can't access any of
the information that was not rendered on the last section. It's
obviously
in the ViewState, since the page remembers the value, but I can't figure

out
how to read those values.

The controls I am trying to get the values for are databound controls. I
don't know if this makes a difference or not.


Nov 19 '05 #3

"Random" <ci*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
The way I've built my page is to take the user through a multi-form process, only rendering those controls that are needed for each section. The
ViewState is working the way I want it to, remembering items across the
process, back and forth. But when the user finally opts to complete the
sections and commit the information for processing, I can't access any of
the information that was not rendered on the last section. It's obviously
in the ViewState, since the page remembers the value, but I can't figure out how to read those values.

The controls I am trying to get the values for are databound controls. I
don't know if this makes a difference or not.

You can place your own items in viewstate and retrieve them at the time of
committing the last form. Hope this helps.
Mike
Nov 19 '05 #4
Thanks, Mike. Yes, this is what I am ending up doing. I don't wish to be
taken wrong, I know it's just a learning curve. I'm just frustrated that
many tasks that I would be able to do fast and simply in classic ASP, there
seems to be a huge workaround needed to get it to work with .NET.

There are many other workarounds I've had to make on this page because of
the difficulty in getting the html controls and server controls to work
together. It would all be MUCH simpler if ASP.NET would not rename all the
server controls on the client side.
"vMike" <Mi************ ****@noZorY.geZ waYrrenY.com> wrote in message
news:ct******** **@ngspool-d02.news.aol.co m...

"Random" <ci*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
The way I've built my page is to take the user through a multi-form

process,
only rendering those controls that are needed for each section. The
ViewState is working the way I want it to, remembering items across the
process, back and forth. But when the user finally opts to complete the
sections and commit the information for processing, I can't access any of
the information that was not rendered on the last section. It's
obviously
in the ViewState, since the page remembers the value, but I can't figure

out
how to read those values.

The controls I am trying to get the values for are databound controls. I
don't know if this makes a difference or not.

You can place your own items in viewstate and retrieve them at the time of
committing the last form. Hope this helps.
Mike

Nov 19 '05 #5

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

Similar topics

7
2043
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get them, or how do we get that value? I always have to set the ViewState("FirstName") = txtBox.text myself before a postback is done, otherwise, the value of ViewState("FirstName") is always empty; there doesn't seem to be a way to retrieve that...
0
926
by: Raed Sawalha | last post by:
we have web application up running in real environment now, after view did deployment a problem appeared caused by ViewState an exceptions like the following are generated: Message: Invalid length for a Base-64 char array. Trace: at System.Convert.FromBase64String(String s) at System.Web.UI.LosFormatter.Deserialize(String input) at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
6
2935
by: sck10 | last post by:
Hello, I have applications that produce the following error when they have been open to long without activity. Is there any way to force a re-load of the page or go to another page if the page has expired instead of getting the error? Thanks,
4
1855
by: Rolf Welskes | last post by:
Hello, the problem seems simple I have an own webcontrol one property is public bool IsEdit { get
6
6261
by: scottrm | last post by:
Hi Users seem to be getting the following intermitent error whe they post a form. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
5
14071
by: russell.lane | last post by:
I'm getting the much-hated "validation of viewstate MAC failed" error. This is on an ASP.Net 2.0 app running in IIS with IE 6+ as the browser. The full error text is: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. The app *is not* running in a cluster or...
5
7262
by: Mark Olbert | last post by:
Tonight's episode of me beating my head bloody against the monitor was the result of ViewState/ControlState information not being available when CreateChildControls() gets called for a CompositeControl. So, my question is, >>why<< isn't ViewState/ControlState available before CreateChildControls() gets called by the Framework? Is it just me, or does it seem really counterintuitive to be creating child controls on postback without the...
9
2670
by: =?Utf-8?B?TUNN?= | last post by:
I'm sure the answer to my question varies depending on the situation, but I am looking for a general "best practice". If I have an asp.net application and I load certain data from a database, should I use ViewState to store and reload the data, or should I load the data from the database on each postback? Assume for the sake of this question that I only care about performance, I don't care about ease of programming.
4
2289
by: =?Utf-8?B?TUNN?= | last post by:
I am trying to disable ViewState at the application level. I have the following line in my web.config: <pages enableViewState="false"></pages> But it is not working. What can I do?
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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
9247
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...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
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
4602
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.