Home All Groups Group Topic Archive Search About
Author
26 Apr 2006 7:00 PM
Justin
I have aspx pages with 10 checkboxlist controls.  total individual checkbox
(the sum of individual checbox in those 10 checkboxlists) on the page is
about 1710.  You can imagine how large the viewstate is.  Is there anyway I
can shrink the viewstate and at the same time get the values of each
checkbox after postback?

Thanks

Author
27 Apr 2006 2:15 AM
Chris Chilvers
On Wed, 26 Apr 2006 15:00:03 -0400, "Justin" <jus***@hotmail.com>
wrote:

>I have aspx pages with 10 checkboxlist controls.  total individual checkbox
>(the sum of individual checbox in those 10 checkboxlists) on the page is
>about 1710.  You can imagine how large the viewstate is.  Is there anyway I
>can shrink the viewstate and at the same time get the values of each
>checkbox after postback?
>
>Thanks
>

On this same point is there anyway to disable saving the data of
controls that hold large amounts of data such as dropdownlists and
datagird but still allow them to store all the smaller values in
viewstate for things like which item index/row index was last
selected?

This would have the basic contract that you would be responsible for
repopulating the data during the init phase so that it is ready for
LoadSavedState.
Author
27 Apr 2006 6:40 AM
CMM
You should ask this question in the aspnet groups, not here.... but
anyhow....

Not sure about the Checkboxlist.... but disabling ViewState does not prevent
you from getting a postback value from any control. In Page_Load
"reconstruct" your checkboxes.... the events fire next, and you will be able
to retrieve the Postbox "value."

I haven't experimented with Checkboxlist.... I know things with ViewState
can get a bit confusing.

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"Chris Chilvers" <kee***@dynafus.com> wrote in message
news:72a0521vg4js7voira5tps7vl20uuviudv@4ax.com...
> On Wed, 26 Apr 2006 15:00:03 -0400, "Justin" <jus***@hotmail.com>
> wrote:
>
>>I have aspx pages with 10 checkboxlist controls.  total individual
>>checkbox
>>(the sum of individual checbox in those 10 checkboxlists) on the page is
>>about 1710.  You can imagine how large the viewstate is.  Is there anyway
>>I
>>can shrink the viewstate and at the same time get the values of each
>>checkbox after postback?
>>
>>Thanks
>>
>
> On this same point is there anyway to disable saving the data of
> controls that hold large amounts of data such as dropdownlists and
> datagird but still allow them to store all the smaller values in
> viewstate for things like which item index/row index was last
> selected?
>
> This would have the basic contract that you would be responsible for
> repopulating the data during the init phase so that it is ready for
> LoadSavedState.
Author
27 Apr 2006 6:56 AM
CMM
Also

>> On this same point is there anyway to disable saving the data of
>> controls that hold large amounts of data such as dropdownlists and
>> datagird but still allow them to store all the smaller values in
>> viewstate for things like which item index/row index was last
>> selected?

Yeah. Disable ViewState for the control, and add your own values to
ViewState manually (ViewState("myvalue") = Somecontrol.SomeValue) and reset
the property in question of the control on Postbacks in Page_Load.

In fact, try completely disabling the ViewState for the Checkboxlist control
and see if you lose anything. I'll be you don't. If you're adding items
manually in Page_Load rather than in the designer simply remove the If
Me.IsPostBack and "reconstruct" the items on every postback. This works
beautifully and everything works!

Note you do not have to "reconstruct" the items in your Checkboxlist in
Page_Load if you define the items in the ASP markup (in the designer). Only
if you create the Checkboxlist.Items manually in code (in the Page_Load
event for instance).

Basically, ViewState allows you to make changes to your controls in the
Code-Behind and have those changes saved on subsequent postbacks.

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:eRCzGWcaGHA.1348@TK2MSFTNGP05.phx.gbl...
> You should ask this question in the aspnet groups, not here.... but
> anyhow....
>
> Not sure about the Checkboxlist.... but disabling ViewState does not
> prevent you from getting a postback value from any control. In Page_Load
> "reconstruct" your checkboxes.... the events fire next, and you will be
> able to retrieve the Postbox "value."
>
> I haven't experimented with Checkboxlist.... I know things with ViewState
> can get a bit confusing.
>
> --
> -C. Moya
> www.cmoya.com
> "Chris Chilvers" <kee***@dynafus.com> wrote in message
> news:72a0521vg4js7voira5tps7vl20uuviudv@4ax.com...
>> On Wed, 26 Apr 2006 15:00:03 -0400, "Justin" <jus***@hotmail.com>
>> wrote:
>>
>>>I have aspx pages with 10 checkboxlist controls.  total individual
>>>checkbox
>>>(the sum of individual checbox in those 10 checkboxlists) on the page is
>>>about 1710.  You can imagine how large the viewstate is.  Is there anyway
>>>I
>>>can shrink the viewstate and at the same time get the values of each
>>>checkbox after postback?
>>>
>>>Thanks
>>>
>>
>> On this same point is there anyway to disable saving the data of
>> controls that hold large amounts of data such as dropdownlists and
>> datagird but still allow them to store all the smaller values in
>> viewstate for things like which item index/row index was last
>> selected?
>>
>> This would have the basic contract that you would be responsible for
>> repopulating the data during the init phase so that it is ready for
>> LoadSavedState.
>
>