Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > CheckBoxList losing viewstate

Reply
Thread Tools

CheckBoxList losing viewstate

 
 
dm_dal
Guest
Posts: n/a
 
      02-17-2004
Is this a known issue or something? During a postback, my CheckBoxList
controls forget which ListItems are Selected.

DMY


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      02-17-2004
Are you rebinding the list or adding items dynamically? Tell us more.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"dm_dal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Is this a known issue or something? During a postback, my CheckBoxList
controls forget which ListItems are Selected.

DMY



 
Reply With Quote
 
 
 
 
dm_dal
Guest
Posts: n/a
 
      02-17-2004
The ListItems are added design time.

In the Page_Load section, enclosed within the if(!IsPostBack) is where I'm
setting the Selected property for each ListItem. Initially, the
CheckBoxList's enabled property is set to false, and when the user clicks
the edit button, this control et.al. are set to enabled. It's during this
postback that the ListItems lose their Selected state.


"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Are you rebinding the list or adding items dynamically? Tell us more.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "dm_dal" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Is this a known issue or something? During a postback, my CheckBoxList
> controls forget which ListItems are Selected.
>
> DMY
>
>
>



 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      02-18-2004
Hi,

that is due to the nature of <input type=checkbox> HTML elements that they
don't post their value when HTML element is disabled, causing selection to
be lost on postback (despite do you change the CheckBoxList to enabled or
not). .

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"dm_dal" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
The ListItems are added design time.

In the Page_Load section, enclosed within the if(!IsPostBack) is where I'm
setting the Selected property for each ListItem. Initially, the
CheckBoxList's enabled property is set to false, and when the user clicks
the edit button, this control et.al. are set to enabled. It's during this
postback that the ListItems lose their Selected state.


"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Are you rebinding the list or adding items dynamically? Tell us more.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "dm_dal" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Is this a known issue or something? During a postback, my CheckBoxList
> controls forget which ListItems are Selected.
>
> DMY
>
>
>




 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      02-18-2004
And to add that the behavior not to post value when INPUT element is
disabled is in the HTML standard. Basically setting the element to be
readonly could work, but not sure if it can be straightforward set to
singular items in CheckBoxlist (ListItem has Attributes property but it
doesn't seem to reflect added attributes what is known bug:
http://support.microsoft.com/default...b;en-us;309338).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist




"dm_dal" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
The ListItems are added design time.

In the Page_Load section, enclosed within the if(!IsPostBack) is where I'm
setting the Selected property for each ListItem. Initially, the
CheckBoxList's enabled property is set to false, and when the user clicks
the edit button, this control et.al. are set to enabled. It's during this
postback that the ListItems lose their Selected state.


"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Are you rebinding the list or adding items dynamically? Tell us more.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "dm_dal" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Is this a known issue or something? During a postback, my CheckBoxList
> controls forget which ListItems are Selected.
>
> DMY
>
>
>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex losing <br> (different from the earlier topic about losing $1) Jason C Perl Misc 4 06-26-2012 10:29 PM
Losing Drives - Finding Drives - Losing Drives mel@no.spam.com Computer Support 2 09-21-2007 10:16 PM
Checkboxlist inside Repeater - doesn't fire click event for Checkboxlist JD ASP .Net 5 08-08-2007 11:28 AM
Losing viewstate after inheriting CheckBoxList Earl Teigrob ASP .Net Web Controls 0 10-03-2006 04:27 PM
How to get Selected item in a Databinded CheckBoxList when CheckBoxlist is in a DataList? Patrick.O.Ige ASP .Net 5 06-19-2005 06:11 AM



Advertisments