Adding Cascading style to LinkButton Control

P

Patrick.O.Ige

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>
 
K

Ken Cox [Microsoft MVP]

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>
 
A

Ashish Kaila

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,815
Members
47,361
Latest member
RogerDuabe

Latest Threads

Top