473,387 Members | 1,344 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,387 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 1878
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...
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: 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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.