473,395 Members | 2,689 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,395 software developers and data experts.

in LoadViewState() : ViewState is empty ??

Hi,

I have a Webform with 1 submit button and 1 label

code behind :
public class MainWebForm: System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblFName;

protected override void LoadViewState( object o )
{
lblFName.Text = (string)ViewState["FName"];
}

protected override object SaveViewState()
{
ViewState["FName"] = "Enter First Name Here";
return base.SaveViewState();
}
}

Upon loading the page the first time
- LoadViewState() is executed but ViewState["FName"] is empty --> normal
- SaveViewState() event is executed as well and saves a value in the
ViewState-object

Page is now displayed with an empty label : OK

Upon pressing the Submit button : page loads a second time
- LoadViewState() is executed and ViewState["FName"] is still empty ????

Why ?

Chris
Nov 17 '05 #1
0 1785

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

Similar topics

0
by: | last post by:
hi, Im trying to use below code in three.ascx which is pasted on two.ascx page and two.ascx is pasted on one.aspx page. But "LoadViewState" gives exceptions mentioned below protected override...
0
by: Christian | last post by:
Hi, I have a Webform with 1 submit button and 1 label code behind : public class MainWebForm: System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblFName; protected override...
2
by: SSW | last post by:
Hi: In aspx.cs page i had written the code below. I have a button control and only create TextBox Control dynamically. LoadViewState is Never called. But when we put datagrid/DataList it...
5
by: William F. Robertson, Jr. | last post by:
I am having difficulty in diagnosing this problem and was throwing it out for some other eyes. I have derived my own Page class from System.Web.UI.Page and have overridden the LoadViewState...
2
by: Devin Fensterheim | last post by:
Does anyone know of an issue with a control's viewstate not persisting when dynamically adding custom controls to a web form using AddAt? If a control is added to an HTML form directly using the...
0
by: Ferret | last post by:
I've found what seems to be a nasty bug in the DataGrid and Repeater classes. If CreateChildControls gets called before LoadViewState, ViewState fails to map and you end up with nothing on a...
6
by: Nergal | last post by:
LoadViewState is taking a long time on a page, the bigger the dataset the longer the wait and also it takes longer on remote server than local host. EnableViewState is FALSE and when I examine...
0
by: Vishal | last post by:
Hello, I have overrided the LoadViewState function in my webform. However when the page postsback the function is never called. Here is how I overrided it. Protected Overloads Sub...
0
by: Anand Saha | last post by:
In case you are creating your own control dynamically and need to re-create them on LoadViewState, only to discover that this function is not being called by the framework, reason and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
0
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,...
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,...

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.