Values disappearing on PostBack

G

Guest

I have a web page that contains, amongst other things, a DropDownList called
drpProjectCodes) and a Panel (called pnlStatus) which contains six Checkboxes.

drpProjectCodes contains a list of project codes plus an 'All' option. If
All is selected then the user can selected statuses using the CheckBoxes
otherwise the CheckBoxes are disabled by disabling pnlStatus. Several of the
Checkboxes are checked by default.

There are actually other DropDownLists on the page and all of them postback
after the selection is changed as the contents of each list is dynamically
determined by the value in the others.

The problem occurs when the user selects a specific project from
drpProjectCodes (so pnlStatus is then disabled) and then selects from another
DropDownList. After the postback all the checkboxes have lost their state
(which needs to be maintained).

I'm assuming this is because Internet Explorer does not post data from
disabled controls.

To get round this I'm thinking of:

If pnlStatus.Enabled() Then
Store CheckBox values in variables
End If
Set values of CheckBoxes from variables

This seems like a very inelegant solution. Has anyone got any better ideas?

Many thanks for any advice.

Alan
 
G

Guest

Hi Alan,

You can also have hidden checkboxes and use them as the real containers of
the values. This allows you to enable/disable the panel without affecting the
way in which the data is posted back (because you are using the values of the
hidden controls).

Hope this helps,
Regards,
Leon
 
G

Guest

Nice idea. I'll give it a try.
Many thanks

Alan

Leon Welicki said:
Hi Alan,

You can also have hidden checkboxes and use them as the real containers of
the values. This allows you to enable/disable the panel without affecting the
way in which the data is posted back (because you are using the values of the
hidden controls).

Hope this helps,
Regards,
Leon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top