Ranadheer Reddy
Ranadheer Reddy

Reputation: 4324

Controls that don't have ViewState

I am very new to Asp.Net.

Almost all the controls i have seen till now has ViewState.

So, my question is Are there any controls that don't have ViewState ? What are they.

I have googled, but din't find the correct solution.

Thank you !!

Upvotes: 0

Views: 67

Answers (1)

Knaģis
Knaģis

Reputation: 21485

Every control has ViewState because that is where all attribute values are stored.

To avoid ViewState you can disable it on the control (EnableViewState=false) and make sure when you set any properties (like Text, Visible etc.) you do that yourself on every postback (so that ViewState is not needed) - so in events like Page_Load instead of Button_Click.

Upvotes: 3

Related Questions