473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

CssClass

Hello,

On a class I am defining the CssClass of a control at runtime.
However, I would also like to create the CssClass at runtime. Is this
possible?

Something like:
Dim myCssClass="clear:both; color: #FFFFFF"
MyControl.CssClass = myCssClass

Thanks,
Miguel

May 29 '07 #1
3 2186
CssClass is the html class attribute and should be the name of a style
class, not a style command.

you can render the style commands at runtime.

-- bruce (sqlwork.com)
shapper wrote:
Hello,

On a class I am defining the CssClass of a control at runtime.
However, I would also like to create the CssClass at runtime. Is this
possible?

Something like:
Dim myCssClass="clear:both; color: #FFFFFF"
MyControl.CssClass = myCssClass

Thanks,
Miguel
May 29 '07 #2
Sure:

Dim myCssClassName As String ="myCSS"
Dim myCssClassDefinition As String = "clear:both; color: #FFFFFF"
Dim ltrl As Literal = New Literal
ltrl.Text = String.Format("<{0} type='text/css'>.{1} {{{2}}}</{0}>",
"style", myCssClassName , myCssClassDefinition)
Me.Page.Header.Controls.Add(ltrl)

' and then assign your class to controls:
MyControl.CssClass = myCssClassName

"shapper" wrote:
Hello,

On a class I am defining the CssClass of a control at runtime.
However, I would also like to create the CssClass at runtime. Is this
possible?

Something like:
Dim myCssClass="clear:both; color: #FFFFFF"
MyControl.CssClass = myCssClass

Thanks,
Miguel

May 29 '07 #3
On May 29, 11:50 pm, shapper <mdmo...@gmail.comwrote:
Hello,

On a class I am defining the CssClass of a control at runtime.
However, I would also like to create the CssClass at runtime. Is this
possible?

Something like:
Dim myCssClass="clear:both; color: #FFFFFF"
MyControl.CssClass = myCssClass

Thanks,
Miguel
http://groups.google.com/group/micro...200e6aec7f6062

May 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
6
by: msuk | last post by:
All, I have a ASP.NET/C# webform which contains a Webform button that has a CssClass applied to give it a special effect. Now the same webform has a filefield control but the browse button is...
6
by: tshad | last post by:
Are Validators able to use CSSClass? I have the following: <asp:RegularExpressionValidator ControlToValidate="txtEmail" CssClass="errorMessage" Text = "Invalid Email Address!"...
1
by: chrisfox | last post by:
Hi, I try to customize the style of my Webparts with a CSS Stylesheet. Therefore I define a CSS File and define some CSS Classes. Now a problem occurs. Some of the classes have no effect on the...
2
by: prasad | last post by:
see iam having a user control and i want a cssclass for that users control ,no prolem in providing that .but the problem is that it requires two diff styles for the same control so i need two...
2
by: Kevin L. Kitchens | last post by:
Howdy... Been toying the the asp:menu object in order to dump the manually generated menu I've been using, however, I cannot seem to get the coloring to work properly. First off, what CSS...
2
by: shapper | last post by:
Hello, I created a custom control that inherits CompositeControl: Public Class MySection Inherits CompositeControl ... Protected Overrides Sub CreateChildControls() ......
1
by: Jonathan Wood | last post by:
Greetings, On a GridView control, I want to show alternating colors. But instead of alternating on each row, I want to alternate each group. So several items would be one color and the next...
0
by: HillBilly | last post by:
MasterPages again. Three LinkButtons are being used as styled tabs in the content page that will load a different ListView when a tab is selected: TabA, TabB or TabC. The LinkButtons are declared...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.