views:

113

answers:

1

I am currently working on a localization project for an ASP .NET application. I currently have a massive page with a multi view with about 9 tabs with each tab containing lots of data. I was just wondering, I put a lot of tag on my ASPX page so that I could localize my text easily. I was wondering if the amount of Label has a big impact on the view state size? Or performance of the page.

I read on another text (here) that a single asp:Label at the minimum contains 52bytes of data. So if I have a lot of label controls it would be additional unused data being sent back and forth. I was wondering why does it even need 52 bytes of view state if it is just a label. Also, are there any other approach to doing localization in ASP .NET other than the built in feature of Microsoft.

+1  A: 

The <asp:Label> Text property will not be persisted in ViewState if does not change between Postbacks. The ViewState that you see generated for an <asp:Label> control is the data that gets generated by the label's ControlState when SaveViewState() is called on the Control.

Let me clarify - ViewState tracks changes to the page. If the text of the <asp:Label> is being set in the aspx markup (or code-behind) and never changes, then the size of the ViewState will not change (the ViewState for the Label control does not contain any data pertaining to the Text property). In this situation, I would be inclined to set EnableViewState to false so that no data is put into ViewState for the label at all.

I would recommend reading TRULY UnderStanding ViewState for more details.

Russ Cam