tables without viewstate

chart

Newcomer
Joined
Mar 31, 2004
Messages
3
Hi,

I am working on a web form with several asp tables which results in a rather large view state. From what I read about view state, I should be able to turn view state off and still retrieve the cell values of the table with server code when the form posts. But alas, the text property of the cells is empty when I do this. I am reading (or trying to) the table contents from the pageLoad event handler:

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

cellvalue1 = Table1.Rows(0).Cells(0).Text
...
end sub

... but Table1.Rows(0).Cells(0).Text returns an empty string regardless of the tables content during post.

Any suggestions?

Thanks.

Charles
 
"From what I read about view state, I should be able to turn view state off and still retrieve the cell values of the table with server code when the form posts."

where did you read that at? ViewState is what holds the values to keep the "state" of the form......

if you don't use ViewState (which really.. how much extra speed/performance is one really going to get), you are going to have to use the good ol Request.Form collection
 
MorningZ said:
"where did you read that at? ViewState is what holds the values to keep the "state" of the form......"

Thanks for your thoughtful reply, Morning Z. I read that here:

http://msdn.microsoft.com/msdnmag/issues/03/02/CuttingEdge/

Scroll down to the section, "Programming Without View State". Here's an exerpt: "After loading the view state, the page reads client-side information through the Request object and uses those values to override most of the settings for the server controls. In general, the two operations are neatly separated and take place independently. In particular, though, the second operation—reading from Request.Form—in many situations ends up just overriding the settings read out of the view state. In this particular case the view state is only an extra burden.... In short, as long as you're simply interested in persisting properties such as Text or Checked you don't have any need for view state."

In my case the savings in page size are 7-10K on a page that is already pushing 35k.

It may not be possible but the way the guy that wrote the MSDN article went on, I thought I thought there might be someone who knew how to do this.

Charles
 
No problem. Thanks for the tip on html compression. I will look into it. What was that you said about Request.forms collection? I am really a newbie at this and still learning the ropes.

Charles
 
Back
Top