Advertisements

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.

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). .

"dm_dal" <> wrote in message
news:%23%...
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.

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.aspx?scid=kb;en-us;309338).

"dm_dal" <> wrote in message
news:%23%...
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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!