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: Thu, 9 Aug 2007 13:59:39 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Homer J. Simpson
          2    Homer J. Simpson
                 3    Homer J. Simpson


Manipulating style at runtime?   
Hi all,

I'm trying to manipulate a calendar header's style programmatically at 
runtime.  This works:

<asp:Calendar id="clndr" [...]>

Page_Load()
{
    clndr.TitleStyle.BackColor = System.Drawing.Color.FromArgb( 255, 0, 0 );
}

This, however, doesn't:

Page_Load()
{
    clndr.TitleStyle.CssClass.Insert( 0, "background-color: #FF0000;" );
}

Am I misinterpreting the intent behind CssClass.Insert()?


I know I could stick with TitleStyle.BackColor, but what I'm ultimately 
trying to do is specify an attribute that isn't recognized as a member of 
clndr.TitleStyle.CssClass.  I'm just experimenting for now.  This 
calendar--being ported from classic ASP--used to have the following style:

..title
{
    filter: 
progid:DXImageTransform.Microsoft.Gradient(startColorStr='#000000', 
endColorStr='#D4D0C8', gradientType='1');
}

Obviously, "filter" isn't a member of clndr.TitleStyle (so I couldn't change 
its startColorStr or endColorStr values), so I thought I could get around 
that with something like:

string strFilter = "filter: 
progid:DXImageTransform.Microsoft.Gradient(startColorStr='#000000', 
endColorStr='#D4D0C8', gradientType='1');";
clndr.TitleStyle.CssClass.Insert( 0, strFilter ).

However my test above with the background-color attribute tells me I'm doing 
something wrong.  If I could get *that* to work first, then I'll try to get 
the filter attribute to work next...
Date:Thu, 9 Aug 2007 13:59:39 -0400   Author:  

Re: Manipulating style at runtime?   
DOH!

I can't believe the stupidity.

CssClass.Insert() inserts some characters in a string.  Namely, the class 
name.

Okay, well...anyone wants to take a shot at what I was trying to accomplish 
in my original message?
Date:Thu, 9 Aug 2007 14:18:19 -0400   Author:  

Re: Manipulating style at runtime?   
Nobody?

Okay, let me rephrase the question in a more generic way:

How do I dynamically change (or add) a value for a css attribute, when that 
particular attribute doesn't have a corresponding member in code?

In other words, I want code to add the following css attribute:

filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#000000', 
endColorStr='#D4D0C8', gradientType='1');

....in my Page_Load() event.  How do I get to the class and add this string 
to it?
Date:Fri, 10 Aug 2007 09:50:59 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


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