Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > stylesheet with masterpage

Reply
Thread Tools

stylesheet with masterpage

 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-28-2008
asp.net 2.0

I'm new at so much of this. I'd like to apply a very simple css file to some
asp buttons on content pages via the master page. Not sure if that's
possible but I assume it is from what I've read. I just can't figure out
where to put things.

So here's my master page:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<title>Untitled Page</title>
<link rel="stylesheet" type="text/css"
href="~\App_Themes\KeithTest\AspButtons.css" />
</head>

Here's my AspButtons.css file:

..WhiteButtons
{
BackColor="#FFFBFF"
BorderColor="#CCCCCC"
ForeColor="#284775"
Height="28px"
Font-Size="11pt"
BorderWidth="2px"
BorderStyle="Outset"
}

I thought I would then put "WhiteButtons" in the cssClass of each button on
each content page but that didn't work and it seems like way more work than
is necessary given what I'm gleaning about stylesheets.

So should I change .WhiteButtons to soemthing else in the css file so that
it would automatically apply to all asp:buttons? What do I need to do and
where to put it in the content pages?

Here's one of the buttons on one of the content pages:

<asp:Button ID="btnSubmit" runat="server" Text="Submit for Approval"
OnClick="btnSubmit_Click" Width="175px" />

I need some clear info on this as I'm sort of stumbling around with it rigth
now. Hope someone can clear this up for me!

Thanks,

Keith



 
Reply With Quote
 
 
 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-28-2008
Ok. I just discovered that my css file is all wrong. It should be:

..WhiteButtons
{
background-color:#FFFBFF;
border-color:#CCCCCC;
color:#284775;
height:28px;
font-size:11px;
border-width:2px;
border-styleutset;
}

That's ok now I guess but I'll still need my other quesitons answered.

Keith


 
Reply With Quote
 
 
 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-28-2008
So I tried changing .WhiteButtons to just "input" (wihtout the quotes) to
see what would happen and it worked. My asp button is following the css
below. But I ptu some other "input" types of controls on the page and so do
they. I only want my asp:button controls to follow the css below. What do I
need to do to do that?

Keith

"Keith G Hicks" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ok. I just discovered that my css file is all wrong. It should be:
>
> .WhiteButtons
> {
> background-color:#FFFBFF;
> border-color:#CCCCCC;
> color:#284775;
> height:28px;
> font-size:11px;
> border-width:2px;
> border-styleutset;
> }
>
> That's ok now I guess but I'll still need my other quesitons answered.
>
> Keith
>
>



 
Reply With Quote
 
Paulus E Kurniawan
Guest
Posts: n/a
 
      02-28-2008
Keith,

You can use the CSS attribute selector, but this is not supported on IE6 or
earlier:

input[type="submit"]
{
height:28px;
font-size:11pt;
color:#284775;
background-color:#fffbff;
borderutset 2px #ccc;
}

If you are using ASP.NET 2.0 or later, you can create a skin file to apply
the rules to all the buttons by addding this line to your skin file:

<asp:Button runat="server" CssClass="WhiteButtons" />

This way you don't need to assign the CssClass property for every button
control.

Hope this helps.

--
Paulus E Kurniawan
http://www.paulusevan.net


"Keith G Hicks" wrote:

> So I tried changing .WhiteButtons to just "input" (wihtout the quotes) to
> see what would happen and it worked. My asp button is following the css
> below. But I ptu some other "input" types of controls on the page and so do
> they. I only want my asp:button controls to follow the css below. What do I
> need to do to do that?
>
> Keith
>
> "Keith G Hicks" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Ok. I just discovered that my css file is all wrong. It should be:
> >
> > .WhiteButtons
> > {
> > background-color:#FFFBFF;
> > border-color:#CCCCCC;
> > color:#284775;
> > height:28px;
> > font-size:11px;
> > border-width:2px;
> > border-styleutset;
> > }
> >
> > That's ok now I guess but I'll still need my other quesitons answered.
> >
> > Keith
> >
> >

>
>
>

 
Reply With Quote
 
Keith G Hicks
Guest
Posts: n/a
 
      02-28-2008
Progress. I changed all my asp:buttons on the content pages so that they are
CssStyle=WhiteButtons and in the IDE they all take on the correct style.
They follow the below. HOwever, when I run the app in my browser, they do
not. They appear as just standard asp buttons (gray, raised, etc.)
So I decided to check browser compatibility. I generally use FireFox. I ran
my URL in IE6 and the buttons are fine. I read on www.w3schools.com " All
major browsers support Cascading Style Sheets." I consider FireFox a major
browser these days. I have loads of clients and collegues that use it. I
tested my css file here
http://jigsaw.w3.org/css-validator/v...date-by-upload it
seems like it should be fine.



"Keith G Hicks" <(E-Mail Removed)> wrote in message
news:Oh#(E-Mail Removed)...
> So I tried changing .WhiteButtons to just "input" (wihtout the quotes) to
> see what would happen and it worked. My asp button is following the css
> below. But I ptu some other "input" types of controls on the page and so

do
> they. I only want my asp:button controls to follow the css below. What do

I
> need to do to do that?
>
> Keith
>
> "Keith G Hicks" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Ok. I just discovered that my css file is all wrong. It should be:
> >
> > .WhiteButtons
> > {
> > background-color:#FFFBFF;
> > border-color:#CCCCCC;
> > color:#284775;
> > height:28px;
> > font-size:11px;
> > border-width:2px;
> > border-styleutset;
> > }
> >
> > That's ok now I guess but I'll still need my other quesitons answered.
> >
> > Keith
> >
> >

>
>




 
Reply With Quote
 
Keith G Hicks
Guest
Posts: n/a
 
      02-28-2008
Well using themes seems to have solved the FireFox issue. Thanks for the
info on that. And it seems more flexible too.


"Paulus E Kurniawan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Keith,
>
> You can use the CSS attribute selector, but this is not supported on IE6

or
> earlier:
>
> input[type="submit"]
> {
> height:28px;
> font-size:11pt;
> color:#284775;
> background-color:#fffbff;
> borderutset 2px #ccc;
> }
>
> If you are using ASP.NET 2.0 or later, you can create a skin file to apply
> the rules to all the buttons by addding this line to your skin file:
>
> <asp:Button runat="server" CssClass="WhiteButtons" />
>
> This way you don't need to assign the CssClass property for every button
> control.
>
> Hope this helps.
>
> --
> Paulus E Kurniawan
> http://www.paulusevan.net
>
>
> "Keith G Hicks" wrote:
>
> > So I tried changing .WhiteButtons to just "input" (wihtout the quotes)

to
> > see what would happen and it worked. My asp button is following the css
> > below. But I ptu some other "input" types of controls on the page and so

do
> > they. I only want my asp:button controls to follow the css below. What

do I
> > need to do to do that?
> >
> > Keith
> >
> > "Keith G Hicks" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Ok. I just discovered that my css file is all wrong. It should be:
> > >
> > > .WhiteButtons
> > > {
> > > background-color:#FFFBFF;
> > > border-color:#CCCCCC;
> > > color:#284775;
> > > height:28px;
> > > font-size:11px;
> > > border-width:2px;
> > > border-styleutset;
> > > }
> > >
> > > That's ok now I guess but I'll still need my other quesitons answered.
> > >
> > > Keith
> > >
> > >

> >
> >
> >



 
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
Changing a control on a masterpage that uses a second masterpage Torben Laursen ASP .Net 4 03-15-2008 03:27 AM
Masterpage change its masterpage mr t ASP .Net 0 08-29-2007 10:11 PM
MasterPages - take plain form, add MasterPage. MasterPage does NOT appear when run Randy Smith ASP .Net 9 04-14-2007 09:06 AM
MasterPage inheriting a MasterPage... is it possible? ThunderMusic ASP .Net 2 09-27-2006 07:57 PM
MasterPage -> Page -> MasterPage Code Access =?Utf-8?B?QWxleCBNYWdoZW4=?= ASP .Net 3 04-14-2006 12:34 PM



Advertisments