How to know that viewstates a control save ? for example a DropDownList control.

J

Joao S Cardoso [MVP]

Can u please rephrase that? Not sure if I got it right...

If you are loking for the option for the state on a dropdownlist to be stored on
viewstate then what you are looking for is the enableviewstate property. This is
a common property in webcontrols.

Joao Cardoso (MVP dotNET)
=======================================================
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
(e-mail address removed)-s.p-a.m - www.acinet.pt
=======================================================
 
X

xu

Thank your reply.

I want to know what properties of a control will be need to re-initialize by
programmer,what properties of a control will be assigned by viewstates or
postback-date automatically when a page are postbacking.
 
T

Teemu Keiski

Hi,

general rule is that those properties that are posted by default by the
control, are not persisted in ViewState weheras those proeprties that can't
be maintained without ViewState mechanism are again persisted through it.

TextBox's Text is an example of property that is posted automatically.
ViewState is used with it, but to detect if the value ahs been changed since
last postback (which is informed by raising TextChanged event). Sae idea is
with DropDownList, SelectedItem and SelectedIndexChanged event.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist



xu said:
Thank your reply.

I want to know what properties of a control will be need to re-initialize by
programmer,what properties of a control will be assigned by viewstates or
postback-date automatically when a page are postbacking.


Joao S Cardoso said:
Can u please rephrase that? Not sure if I got it right...

If you are loking for the option for the state on a dropdownlist to be stored on
viewstate then what you are looking for is the enableviewstate property. This is
a common property in webcontrols.

Joao Cardoso (MVP dotNET)
=======================================================
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
(e-mail address removed)-s.p-a.m - www.acinet.pt
=======================================================
 
X

xu

I mean if the property of a control will be posted or persisted in ViewState
when i use it, the point isn't explained in the documents. If can i be aware
of it by testing only?

Teemu Keiski said:
Hi,

general rule is that those properties that are posted by default by the
control, are not persisted in ViewState weheras those proeprties that can't
be maintained without ViewState mechanism are again persisted through it.

TextBox's Text is an example of property that is posted automatically.
ViewState is used with it, but to detect if the value ahs been changed since
last postback (which is informed by raising TextChanged event). Sae idea is
with DropDownList, SelectedItem and SelectedIndexChanged event.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist



xu said:
Thank your reply.

I want to know what properties of a control will be need to
re-initialize
by
programmer,what properties of a control will be assigned by viewstates or
postback-date automatically when a page are postbacking.


Joao S Cardoso said:
Can u please rephrase that? Not sure if I got it right...

If you are loking for the option for the state on a dropdownlist to be stored on
viewstate then what you are looking for is the enableviewstate
property.
This is
a common property in webcontrols.

Joao Cardoso (MVP dotNET)
=======================================================
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
(e-mail address removed)-s.p-a.m - www.acinet.pt
=======================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top