469,572 Members | 1,384 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

A question of (web)control and CssClass

I am doing a custom control.
It contains a label and a textbox and a button.
The class inherits WebControl.

Thus the control gets a property CssClass visible in the Properties window.

Question 1. Is it possible to override this property AND give it another
name, for example CssClassLabel?
Is it ugly doing it as a CSV-property type "cssstyle1,cssstyle2,cssstyle3"?

Since the control contains three controls I need to give CssClass-properties
for each containde control.

Question 2: Is this possible without resorting to prepertyname like
CssClassLabel, CssClassButton etc.
I have seen that Font has subnode in the properties window.

Question 3: Is this possible in my own code? Type: CssClasses containg three
subnodes: CssClassLabel, CssClassButton and so on
/k
Jan 17 '06 #1
1 1492
> Question 1. Is it possible to override this property AND give it another
name, for example CssClassLabel?
No; you can override it by giving it the same name, or create another
property with a different name, but not a property with a different
name that acts as a new virtual implementation. If you need to override
the base class functionality for calls from the base class (i.e. use it
as a virtual method), you'll need to create a property (CssClass) with
the same name using the 'override' modifier; you could then create
another property (CssClassLabel) and make trivial accessors that just
call your overridden version.

I doubt you *really* want to do this, though, especially given your
other questions. If the 'Label' style overrides the inherited CssClass,
then what happens to the others?
Is it ugly doing it as a CSV-property type "cssstyle1,cssstyle2,cssstyle3"?
Yes, somewhat. But it'll work...
Since the control contains three controls I need to give CssClass-properties
for each containde control.
Question 2: Is this possible without resorting to prepertyname like
CssClassLabel, CssClassButton etc.
Well, it might be, but I'm not sure *why* you'd particularly want to.
I have seen that Font has subnode in the properties window.
Question 3: Is this possible in my own code? Type: CssClasses containg three
subnodes: CssClassLabel, CssClassButton and so on


Not so far as I know

Jan 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by dale zhang | last post: by
1 post views Thread by William Parker | last post: by
4 posts views Thread by DotNetJunkies User | last post: by
2 posts views Thread by Miky | last post: by
reply views Thread by pabloazorin | last post: by
5 posts views Thread by John Kotuby | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.