Style asp.net controls with CSS

  • Thread starter Thread starter Bobby Edward
  • Start date Start date
B

Bobby Edward

Is it possible to stype the asp.net controls (asp:Login, asp:GridView,
asp:FormView; asp:DropDownList, etc...) with a standard css file?

Any suggestions?

Thanks...
 
I don't see why not. How are you defining the style rule in the css file
(what type of selector are you using)? If you are using a class selector for
the style rule, then all you should need to do is set the CssClass property.
However, because some controls do not simply generate one tag (such as
GridView, FormView, Login, and several others), you may want to look at what
tags are generated to determine where to put the CssClass property, you may
often need to put it in a control that is in the template used by the
control, or sometimes certain controls have an extra property for the style
of a certain part. But two of the key things that you can do are look at
what is generated so you know what html tags you are dealing with, and you
can also use the css child selectors in your css file to help when you only
have the opportunity to assign a value to one CssClass property. Just fool
around with these options and you can usually find a way to do it if it can
be done with css. Good Luck!
 
Back
Top