DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 20 Aug 2007 19:40:09 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Nathan Sokalski
          2    unknown
          3    unknown
          4    Nathan Sokalski
          5    RSH


Retrieving Stylesheet information from a CSS file   
I have an ASPX file in which there are properties that depend on the CSS 
properties in a *.css file specified in a link tag, such as:

<link href="mystyles.css" rel="stylesheet" type="text/css"/>

Is there a way to get the classes/properties from this file for use in the 
codebehind? In my specific case, I want to know the border-left-width and 
border-right-width values, or if these properties are not specified, the 
border-width. My reason for needing these is because I must specify the 
width for a certain control, but in order to fit inside the containing 
control, the sum of the width and the border must be less than a certain 
amount. Any ideas? Thanks.
-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
Date:Mon, 20 Aug 2007 19:40:09 -0400   Author:  

Re: Retrieving Stylesheet information from a CSS file   
On Aug 20, 7:40 pm, "Nathan Sokalski"  wrote:

> I have an ASPX file in which there are properties that depend on the CSS
> properties in a *.css file specified in a link tag, such as:
>
> <link href="mystyles.css" rel="stylesheet" type="text/css"/>
>
> Is there a way to get the classes/properties from this file for use in the
> codebehind? In my specific case, I want to know the border-left-width and
> border-right-width values, or if these properties are not specified, the
> border-width. My reason for needing these is because I must specify the
> width for a certain control, but in order to fit inside the containing
> control, the sum of the width and the border must be less than a certain
> amount. Any ideas? Thanks.
> --
> Nathan Sokalski
> njsokal...@hotmail.comhttp://www.nathansokalski.com/


Not sure I fully understand your questions, but I'm guessing at what
you're asking...  You are attempting to determine the numerical value
of some sort of property specified within the CSS profile, so that you
can replicate this value elsewhere.

Now, off the top of my head (and i'm not an ASP.NET wizard by any
stretch), other than grabbing a width value from an already drawn
object, I can't think of a way to grab that value without physically
reading the file.  My suggestion would be to, if you can't find
another solution, pattern match that line in the CSS file.  It's not
terribly efficient, nor elegant, but it may hack together what you
need till you get a better response on here.
Date:Mon, 20 Aug 2007 19:46:48 -0700   Author:  

Re: Retrieving Stylesheet information from a CSS file   
Could you use the CSS max-width property instead and just specify the
maximum width for the control?

Mark,
http://aspnetlibrary.com
Date:Tue, 21 Aug 2007 09:12:56 -0000   Author:  

Re: Retrieving Stylesheet information from a CSS file   
I think that property would accomplish what I want, but unfortunately it 
does not seem to be supported (or at least it doesn't seem to be working) in 
IE6. I don't know about other browsers, but since IE6 is a relatively common 
browser, I need it to work in it. Here is the section of HTML that I used:

<a 
style="display:block;max-width:175px;width:500px;background-color:Blue;">Computers/Electronics</a>

The width was definitely more than 175px, so I think I'll have to keep 
looking for a solution. But thanks for the suggestion, if CSS was fully 
supported I think it would have worked.
-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

"ca8msm@aspnetlibrary.com"  wrote in message 
news:1187687576.196323.236140@o80g2000hse.googlegroups.com...

> Could you use the CSS max-width property instead and just specify the
> maximum width for the control?
>
> Mark,
> http://aspnetlibrary.com
> 
Date:Tue, 21 Aug 2007 21:21:48 -0400   Author:  

Re: Retrieving Stylesheet information from a CSS file   
Nathan,

Could you specify a dynamic width in the css?  For example:
..ControlWidthClass
{
    width:100%;
}

Then create a table for your control and specify the 
class=ControlWidthClass.

Just a thought,
Ron



"Nathan Sokalski"  wrote in message 
news:uEpSvN44HHA.5740@TK2MSFTNGP04.phx.gbl...

>I have an ASPX file in which there are properties that depend on the CSS 
>properties in a *.css file specified in a link tag, such as:
>
> <link href="mystyles.css" rel="stylesheet" type="text/css"/>
>
> Is there a way to get the classes/properties from this file for use in the 
> codebehind? In my specific case, I want to know the border-left-width and 
> border-right-width values, or if these properties are not specified, the 
> border-width. My reason for needing these is because I must specify the 
> width for a certain control, but in order to fit inside the containing 
> control, the sum of the width and the border must be less than a certain 
> amount. Any ideas? Thanks.
> -- 
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
> 
Date:Thu, 23 Aug 2007 10:49:55 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us