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

LoadViewState works only when datagrid or datalist control not when TextBoxa and other server controls?

SSW
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 works. Can any one help me with this?

Thanks,

SSW
MCSD, MCAD, OCA
----------------------------------------------------------------------------
----------------------------------------------------------------------------

Code
----------------------------------------------------------------------------
----------------------------------------------------------------------------
protected override void LoadViewState(object savedState)
{
Reponse.Write("In LoadViewState");
base.LoadViewState(savedState);
BindControl(); /// A function to create dynamic Controls...
Response.Write("SDFSDF");
}

----------------------------------------------------------------------------
----------------------------------------------------------------------------

End of Code
----------------------------------------------------------------------------
----------------------------------------------------------------------------


Nov 17 '05 #1
2 1877
Hi,

I'll try. LoadViewState works just if the server side control save data
to the view state. if data saved to the view state on the next post back
LoadViewState will be called to get the control data store in view
state. if you will add for example this line
this.ViewState.Add("f","g");
LoadViewState will be called since you add data to view state. Every
control that can pass its data via Form (Post), which mean all server
side control that render to variations of INPUT tag, don’t need to store
data in view state since their data is passed inside the Form
collections. That’s the reason that textbox didn’t cause LoadViewState.
HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
SSW
Thanks for ur reply.

But when we make TextBox Server control Visible attribute false at that time it stores in view state and it call's LoadViewState.

Thanks for ur help :)

sswalia
MCSD, MCAD, OCA

"Natty Gur" <na***@dao2com.com> wrote in message news:uq*************@tk2msftngp13.phx.gbl...
Hi,

I'll try. LoadViewState works just if the server side control save data
to the view state. if data saved to the view state on the next post back
LoadViewState will be called to get the control data store in view
state. if you will add for example this line
this.ViewState.Add("f","g");
LoadViewState will be called since you add data to view state. Every
control that can pass its data via Form (Post), which mean all server
side control that render to variations of INPUT tag, don't need to store
data in view state since their data is passed inside the Form
collections. That's the reason that textbox didn't cause LoadViewState.


HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 17 '05 #3

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

Similar topics

0
by: SSW | last post by:
Hi: In aspx.cs page i had written the code below. I only have TextBox and Button Control. LoadViewStateis Never called But when we put datagrid/DataList It works. Can any one, please tell where...
0
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...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
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: ghafranabbas | last post by:
This is how you use the customvalidator control in any INamingContainer interface control (Datagrid, DataList, DataRepeater, etc). 1. In the ItemTemplate, place your customvalidator 2. Set the...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.