By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,684 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,684 IT Pros & Developers. It's quick & easy.

CssClass

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.