T
Tom Jorgenson
I need to create a custom control that behaves like a HyperLink control
EXCEPT where I can get into the events somewhere to programmatically decided
whether to actually perform the link request, or to refuse it.
Why? Because I want to use these links on forms that may have unsaved
changes - and I don't want them to lose the changes by clicking on the
hyperlink.
Unfortunately, I find the web controls bewildering. I would have thought
that if I just created a new type of HyperLink by inherting from a HyperLink
that I could just override the behavior of the base control and everything
would work. When I inherit from it, though, I get a generic control that
displays as pure text - nothing like a HyperLink.
1. Why is this? Why can't controls that inherit from the base web controls
simply override methods and otherwise behave identically to their base class
controls?
Since that didn't work, I tried to inherit from a Label control and override
the OnClick() event. No dice. It isn't in there.
So I tried to inherit from a Button and change the rendering - couldn't make
it work.
You'd think this would be easy. As a matter-of-fact, I would have thought
that Microsoft would have allowed for this simply by overriding events on
the page.
So...
2. Can anyone tell me what's going on here, the basics for inherting from a
..NET control and making it display and operate like its base class, and
where I should go from here?
Thanks in advance!
EXCEPT where I can get into the events somewhere to programmatically decided
whether to actually perform the link request, or to refuse it.
Why? Because I want to use these links on forms that may have unsaved
changes - and I don't want them to lose the changes by clicking on the
hyperlink.
Unfortunately, I find the web controls bewildering. I would have thought
that if I just created a new type of HyperLink by inherting from a HyperLink
that I could just override the behavior of the base control and everything
would work. When I inherit from it, though, I get a generic control that
displays as pure text - nothing like a HyperLink.
1. Why is this? Why can't controls that inherit from the base web controls
simply override methods and otherwise behave identically to their base class
controls?
Since that didn't work, I tried to inherit from a Label control and override
the OnClick() event. No dice. It isn't in there.
So I tried to inherit from a Button and change the rendering - couldn't make
it work.
You'd think this would be easy. As a matter-of-fact, I would have thought
that Microsoft would have allowed for this simply by overriding events on
the page.
So...
2. Can anyone tell me what's going on here, the basics for inherting from a
..NET control and making it display and operate like its base class, and
where I should go from here?
Thanks in advance!