Home > Archive > ASP .NET > July 2004 > Disabled panels reset checkboxes
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Disabled panels reset checkboxes
|
|
| Paul K 2004-07-27, 8:59 pm |
| Whenever I disable a panel, any radio buttons, checkboxes or lists of either are apparently losing their state or are being reset. This only happens when the parent panel is disabled.
Any suggestions would be greatly appreciated!
| |
| Alvin Bruney [MVP] 2004-07-28, 4:01 pm |
| most probably your checkboxes are inside your panels. you may want to remove
them or not disable the panel since it is the parent.
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Paul K" <PaulK@discussions.microsoft.com> wrote in message
news:5F413937-D7B7-46FA-8458-D1633BE88CAB@microsoft.com...
> Whenever I disable a panel, any radio buttons, checkboxes or lists of
> either are apparently losing their state or are being reset. This only
> happens when the parent panel is disabled.
>
> Any suggestions would be greatly appreciated!
| |
| Paul K 2004-07-28, 9:07 pm |
| Sorry, I didn't state my question well. My question is why is this happening? Does disabling panels affect how the viewstate is handled for these particular controls? Textboxes maintain their state.
There are other things I can try, but it would be much less coding to simply disable the panel as a whole as opposed to cycling through all of the contained controls or something else.
It just seems like very odd behavior.
"Alvin Bruney [MVP]" wrote:
> most probably your checkboxes are inside your panels. you may want to remove
> them or not disable the panel since it is the parent.
>
> --
> Regards,
> Alvin Bruney
> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> Got tidbits? Get it here... http://tinyurl.com/27cok
> "Paul K" <PaulK@discussions.microsoft.com> wrote in message
> news:5F413937-D7B7-46FA-8458-D1633BE88CAB@microsoft.com...
>
>
>
| |
| Alvin Bruney [MVP] 2004-07-28, 9:07 pm |
| show me some code, i'll look into it
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Paul K" <PaulK@discussions.microsoft.com> wrote in message
news:74D453C3-D372-4A9D-8469-30FD79E67BA5@microsoft.com...[color=darkred]
> Sorry, I didn't state my question well. My question is why is this
> happening? Does disabling panels affect how the viewstate is handled for
> these particular controls? Textboxes maintain their state.
>
> There are other things I can try, but it would be much less coding to
> simply disable the panel as a whole as opposed to cycling through all of
> the contained controls or something else.
>
> It just seems like very odd behavior.
>
> "Alvin Bruney [MVP]" wrote:
>
| |
| Paul K 2004-07-28, 9:07 pm |
| In the Page.Load event handler I have:
pnlGeneralInfo.Controls.Add(LoadControl("PermitGeneralInfo.ascx"))
pnlZoningReview.Controls.Add(LoadControl("PermitZoningReview.ascx"))
pnlNotes.Controls.Add(LoadControl("PermitNotes.ascx"))
pnlOtherPermits.Controls.Add(LoadControl("PermitOtherPermits.ascx"))
pnlMisc.Controls.Add(LoadControl("PermitMisc.ascx"))
pnlContractors.Controls.Add(LoadControl("PermitContractors.ascx"))
The method I use to iterate through the controls collection is:
Private Sub ToggleEnabled()
For i As Integer = 0 To Me.Controls.Count - 1
If TypeOf Me.Controls(i) Is Panel Then
CType(Me.Controls(i), Panel).Enabled = Not CType(Me.Controls(i), Panel).Enabled
End If
Next i
End Sub
As you'll notice, the panel are loaded with custom controls. The viewstate is enabled for all of the controls.
I thought at first that I need to do a check for the postback, but that isn't the problem. I also tried saving the loaded user control into session variables.
As I'm typing this, I just had the thought that I should try this with checkboxes directly in the panel and see if the same thing happens.
|
|
|
|
|