473,699 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ViewState Not Maintained In Refresh

Hello,

I have a web page, which is being refresh after every
30 secs.Now, there is also a datagrid in it, which i bind
in the pageload event.
Now the problem is when the page is refresh after 30 secs
the datagrid loses it's values.
I mean it does not maintain it's viewstate.

Why is it?

Is it bcuz refresh is not the same as Postback.
buz in postback viewstate is miantained.

Cheers...

Nov 19 '05 #1
1 2329
When you refresh, you are calling the page via a GET, not a POST. Postback
events are POST (the form is posting (sending info) to the server).So, yes,
the viewstate is rebuilt as there is no POST event to send the viewstate
contents to the server.

NOTE: Viewstate is a hidden, encrypted tag in your page. It is not some form
of magic.

Possible solutions:

1. Post everytime a user changes anything (this could get heavy)
2. Use Ajax (Asynch JavaScript and XML) to update the data without a full
page refresh

Since you are refreshing at a rather rapid rate, you may still end up with a
situation where the user changes something and it is not reflected. Thus, one
other solution:

3. Change from meta refresh to a JavaScript POST refresh.

Before doing anything, ask if the 30 second automatic refresh is a mandatory
part of your application.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"batista" wrote:
Hello,

I have a web page, which is being refresh after every
30 secs.Now, there is also a datagrid in it, which i bind
in the pageload event.
Now the problem is when the page is refresh after 30 secs
the datagrid loses it's values.
I mean it does not maintain it's viewstate.

Why is it?

Is it bcuz refresh is not the same as Postback.
buz in postback viewstate is miantained.

Cheers...

Nov 19 '05 #2

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

Similar topics

9
21642
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
1
1503
by: John | last post by:
Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client correctly. However, when I change some data and post it, the viewstate does not seem to load for the user control upon sending it back down to the client. If I change the data again, then the viewstate DOES seem to be maintained. What gives?
1
1214
by: John | last post by:
Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client correctly. However, when I change some data and post it, the viewstate does not seem to load for the user control upon sending it back down to the client. If I change the data again, then the viewstate DOES seem to be maintained. What gives?
10
2273
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
2
2214
by: Prodip Saha | last post by:
I am sure there is an easy fix for this problem. I am reloading the same page at an interval using the meta refresh tag in aspx page. This page has one textbox and one button. The problem is -when the page get posted back to the server the value of the textbox is gone. How do I preserve the value of the textbox that I entered in it? I don't want to use Cache/Session to keep track of the value. That's not an option. Thanks for your...
5
2647
by: Steven Licciardi | last post by:
I have an aspx page with nothing in it but one literal, which I populate with straight forward html (the html consists of about 25 tables with approx. 30 rows each and two columns with text in each cell). When I click to view the aspx page it takes longer than I would have thought for me to recieve the page. On looking at the source the <input type="hidden" name="__VIEWSTATE" value=jkasdkahsj....> is there but the value is vast in size,...
2
2233
by: fabrice | last post by:
Hi, I have a trouble with my TextBox Control and it's ViewState in my form... The property for it, is FALSE as following : <form id="frmSearchBre4" runat="Server"> <asp:textbox id="myID" TabIndex="1" EnableViewState="false" MaxLength="50" runat="server" TextMode="SingleLine"> </asp:textbox>
10
1637
by: Lloyd Dupont | last post by:
When you define UserControl in source code the sample I see are often like that: ============ public string Text { get { String s = (String)ViewState; return ((s == null) ? String.Empty : s); }
4
5052
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a textbox and a dropdowlist: and a button to start something n code-behind: a refresh doesn't send any value back to the server but with a postback, the values are sent? But then, which role does Viewstate play in the postback proces?
0
8617
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
9174
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8914
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6534
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
5875
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
4376
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
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
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.