Groups | Blog | Home
all groups > asp.net webcontrols > october 2004 >

asp.net webcontrols : Adding Cascading style to LinkButton Control



Patrick.O.Ige
10/21/2004 10:37:01 PM
I have this linkbutton control
How can i add Style sheet to the Text, button attribute.
I know i can use CssClass but how would i define the style there to link to
this control..
Any ideas
I WANT TO CHANGE THE COLOR OF A BUTTON FOR EXAMPLE AND THE FONTS!!!!
<asp:Linkbutton id="Button1" onclick="Button1_Click" runat="server"
Text="Expand" BorderStyle=Inset CssClass="" BorderColor=#7da1e9
Width="40%"></asp:Linkbutton>
Ken Cox [Microsoft MVP]
10/22/2004 1:29:02 PM
Hi Patrick,

Is it possible that your inline styles are overriding the styles in the
class? You should be able to configure it to use just styles... or link to a
stylesheet.

<%@ Page Language="VB" %>
<html>
<head>
<style>.buttonstyle {
FONT-SIZE: smaller; BORDER-LEFT-COLOR: #7da1e9; BORDER-BOTTOM-COLOR:
#7da1e9; WIDTH: 40%; COLOR: #c04000; BORDER-TOP-STYLE: inset;
BORDER-TOP-COLOR: #7da1e9; BORDER-RIGHT-STYLE: inset; BORDER-LEFT-STYLE:
inset; BACKGROUND-COLOR: silver; BORDER-RIGHT-COLOR: #7da1e9;
BORDER-BOTTOM-STYLE: inset; f: bold
}
</style>
</head>
<body>
<form runat="server">
<asp:Linkbutton id="Button1" runat="server"
CssClass="buttonstyle">Expand</asp:Linkbutton>
</form>
</body>
</html>


[quoted text, click to view]
Ashish Kaila
10/24/2004 11:02:37 PM
If you have an external css file u can just pick the class and set it in the
CSSClass property of the object. Otherwise there are some properties in
ControlAttribute property of control. Last resort (in case both the above
does not solve ur prob => ControlAttribute does not include the css prop u
wanna change), set it by Object.Styles.Add function.
HTH
Ashish

[quoted text, click to view]

AddThis Social Bookmark Button