473,395 Members | 1,949 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,395 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 8050
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.