473,246 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

? Known Issue: CheckBoxList & viewstate

Is there a know issue surrounding the CheckBoxList control and it's
viewstate?

When my control is created, it's ListItems are checked as needed, but on a
postback, they loose their Selected status.

David
Nov 18 '05 #1
4 8041
Hi david,
I use CheckBoxList control a lot and I don't have any problems so far.
Make sure your EnableViewState = true for the control.
Also if you load the items to the control in the
Page_Load event,make sure to put it in if(!Page.Postback){},
otherwise when you post back if you have some other code to populate the
checkboxlist can make loose the selected status .
I don't know your actual problem unless I see some code.Please provide the
sample code you are using with Checkboxlist
and on which events so that I may be able to help you.

Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com

"dm_dal" <RE******************@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is there a know issue surrounding the CheckBoxList control and it's
viewstate?

When my control is created, it's ListItems are checked as needed, but on a
postback, they loose their Selected status.

David

Nov 18 '05 #2
typing mistake if(!Page.IsPostBack){}
"Marshal Antony" <do***********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi david,
I use CheckBoxList control a lot and I don't have any problems so far. Make sure your EnableViewState = true for the control.
Also if you load the items to the control in the
Page_Load event,make sure to put it in if(!Page.Postback){},
otherwise when you post back if you have some other code to populate the
checkboxlist can make loose the selected status .
I don't know your actual problem unless I see some code.Please provide the
sample code you are using with Checkboxlist
and on which events so that I may be able to help you.

Hope this helps.
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com

"dm_dal" <RE******************@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is there a know issue surrounding the CheckBoxList control and it's
viewstate?

When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected status.

David


Nov 18 '05 #3
I have checked to make sure Enable ViewState is true. The CheckBoxList is
created in the design view, with all the ListItems being created at that
time. In my "Page_Load" section (and within the if(!IsPostBack) loop, is
where I set the Selected items. So they are not being set anywhere else.

The only thing different that I'm doing is, initially, all the controls on
the page are disabled. There is an edit button that, when the user clicks,
causes a postback and the event handler for that button calls a void that
enables the controls. It's during this postback that the view state for the
CheckBoxList appears to be lost.

I've since gone back and replaced this control with three seperate CheckBox
controls and the viewstate is working fine.

On a side note, I did read a reference to the CheckBoxList yesterday (can't
remember where just now), that indicated that the CheckBoxList control does
not implement ISerializable, so the the viewstate of the embedded ListItems
cannot be serialized and saved during postback situations, the suggested
alternative was to create an ArrayList to hold the state of the individual
ListItems during postback.

But, if you can get it to work for you, then I guess that article was bunk.

David

"Marshal Antony" <do***********@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
typing mistake if(!Page.IsPostBack){}
"Marshal Antony" <do***********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi david,
I use CheckBoxList control a lot and I don't have any problems so far.
Make sure your EnableViewState = true for the control.
Also if you load the items to the control in the
Page_Load event,make sure to put it in if(!Page.Postback){},
otherwise when you post back if you have some other code to populate the
checkboxlist can make loose the selected status .
I don't know your actual problem unless I see some code.Please provide the sample code you are using with Checkboxlist
and on which events so that I may be able to help you.

Hope this helps.
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com

"dm_dal" <RE******************@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Is there a know issue surrounding the CheckBoxList control and it's
viewstate?

When my control is created, it's ListItems are checked as needed, but

on a postback, they loose their Selected status.

David



Nov 18 '05 #4
David,
After testing Checkboxlist with the Enabled property I found that
there is a bug with CheckBoxList control.
I didn't experience the problem in my applications because I was not
disabling and enabling the CheckboxList control.
The testing I have done:
Set the enabled property of the Checkboxlist control to
false.While Page_Load, in !Page.IsPostBack set the Selected property
of an item in the Checkbox.After loading the Webform,click on a button
where the enabled property of the Checkboxlist is set to true,the result is,
that item is unchecked!!. I did the same testing for a list box and it is
preserving the selected property.
May be somebody at Microsoft can help you with this bug.
Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com


"dm_dal" <RE******************@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
I have checked to make sure Enable ViewState is true. The CheckBoxList is
created in the design view, with all the ListItems being created at that
time. In my "Page_Load" section (and within the if(!IsPostBack) loop, is
where I set the Selected items. So they are not being set anywhere else.

The only thing different that I'm doing is, initially, all the controls on
the page are disabled. There is an edit button that, when the user clicks, causes a postback and the event handler for that button calls a void that
enables the controls. It's during this postback that the view state for the CheckBoxList appears to be lost.

I've since gone back and replaced this control with three seperate CheckBox controls and the viewstate is working fine.

On a side note, I did read a reference to the CheckBoxList yesterday (can't remember where just now), that indicated that the CheckBoxList control does not implement ISerializable, so the the viewstate of the embedded ListItems cannot be serialized and saved during postback situations, the suggested
alternative was to create an ArrayList to hold the state of the individual
ListItems during postback.

But, if you can get it to work for you, then I guess that article was bunk.
David

"Marshal Antony" <do***********@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
typing mistake if(!Page.IsPostBack){}
"Marshal Antony" <do***********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi david,
I use CheckBoxList control a lot and I don't have any problems
so
far.
Make sure your EnableViewState = true for the control.
Also if you load the items to the control in the
Page_Load event,make sure to put it in if(!Page.Postback){},
otherwise when you post back if you have some other code to populate
the checkboxlist can make loose the selected status .
I don't know your actual problem unless I see some code.Please provide the sample code you are using with Checkboxlist
and on which events so that I may be able to help you.

Hope this helps.
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com

"dm_dal" <RE******************@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Is there a know issue surrounding the CheckBoxList control and it's
> viewstate?
>
> When my control is created, it's ListItems are checked as needed,

but on
a
> postback, they loose their Selected status.
>
> David
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tat | last post by:
Hello, I have an error handling routine in Win app. If there is an error, the app throws an exception and writes it to the text file all info about the error so the app can send it to tech. If...
0
by: rob | last post by:
Here is my scenario: One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView. Then I have a database that has the columns Item1 and Item2 (among others) with the data type bit....
1
by: John Black | last post by:
Hi, I have a code using exception, it works great on Solaris using Forte compiler, but on Linux using gcc3.2, there are some strange problem which ends up "segment fault", I am tracking the...
1
by: Dave Bartlett | last post by:
Hello, When we print a page containing a datagrid, the first page prints fine, but all subsequent pages are printed without table / cell borders i.e. the data is just floating on the page. Is...
1
by: Neven Klofutar | last post by:
Hi, I have a problem, and it seems I have an error in my logic ... First I add a Table control on my webform (EnableViewState is True by default). Then I retrive some information vie...
13
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) ...
0
by: sdoerfli | last post by:
hi, i have a website with a checkboxlist where onclick of a special item of it a highlighting of an object in a map should be performed. my problem is that i could call a javascript on client...
2
by: jwnews1231 | last post by:
Hi, I've been working on minimizing the use of the ViewState in my asp.net applications because of its overhead. The problem I am having is that I keep losing SelectedIndex in the...
4
by: Mythran | last post by:
Reposted, originally posted in microsoft.public.vb.crystal which is not an MSDN managed newsgroup.... POST BELOW --------------------- We develop our applications and reports using Visual...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.