Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Override Css Class

Reply
Thread Tools

Override Css Class

 
 
shapper
Guest
Posts: n/a
 
      02-24-2008
Hello,

I have two custom controls Parent and Child, both inherit from
Composite Control. Child controls are added to parent.

Parent has a property named ChildControlCssClass.

I want ChildControlCssClass to be applied to all Child controls added
to Parent.

However, if I define the CssClass of a Child control then this would
be the one applied and not the ChildControlCssClass defined in its
parent.

What is the right way to do this?

Thanks,

Miguel
 
Reply With Quote
 
 
 
 
Peter Bucher [MVP]
Guest
Posts: n/a
 
      02-24-2008
Hi Miguel

> I have two custom controls Parent and Child, both inherit from
> Composite Control. Child controls are added to parent.
>
> Parent has a property named ChildControlCssClass.
>
> I want ChildControlCssClass to be applied to all Child controls added
> to Parent.
>
> However, if I define the CssClass of a Child control then this would
> be the one applied and not the ChildControlCssClass defined in its
> parent.
>
> What is the right way to do this?

A way would be to override the .Add method of ControlCollection.
But i would prefer to iterate in a time where all child controls added,
througt this collection, try cast to the base class (WebControl) and
set the property manually.

This is in my case, the better way.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
http://www.peterbucher.ch/ - Meine Persönliche Seite

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't override CSS class!!! Jibba Jabba HTML 11 09-29-2007 11:14 PM
override def method in CGI class, without altering the class!?????? Jer A Ruby 2 05-24-2007 06:05 AM
IE6 link colors & CSS override (vs. Firefox) Woodmon HTML 20 10-22-2005 10:12 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
CSS override trouble Andreas Paasch HTML 3 07-10-2003 11:42 AM



Advertisments