I've written a web control that allows you to hide certain bits of
your page when the specified selectbox has a certain value. It's a
simple enough bit of logic, but I got sick of coding it again and
again in different pages. Now I have a page that needs the same
functionality except with a checkbox rather than a dropdown. The code
I need will be mostly the same, so I decided to make a subclass of the
HtmlHider specially for hiding checkboxes.
My problem is that to get the best value out of the existing code, I
need to be able to set the type of the hider control to be "something
that can do a postback" (since this is the only thing that the base
class really needs the hider control to be able to do).
The common parent class of checkbox and dropdown share is WebControl,
but that doesn't support any of the postback functionality
(specifically the autopostback property). I then tried casting the
hider control to the IPostBackDataHandler interface that both dropdown
and checkbox implement, but that didn't give me access to the
autopostback property that I need to access.
Is there a way to do what I want to do or will I just have to rewrite
most the code for the checkbox?
Helen