Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

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

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)

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

On May 29, 11:50 pm, shapper <mdmo@gmail.com> 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

http://groups.google.com/group/microsoft.public.dotnet.framework.aspn...
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc