Forum Moderators: open

Message Too Old, No Replies

How do you style .net panels?

Need to add styles to dynamic panels

         

RossWal

7:42 pm on Dec 12, 2002 (gmt 0)

10+ Year Member



I'm adding some panels dynamically (in code behind) and want to add css styles. I'm thinking I should hardcode a stylesheet, then reference its classes through the cssclass property of the new panels. I'm curious how others approach this topic.

Thanks

tomasz

3:40 pm on Dec 13, 2002 (gmt 0)

10+ Year Member



place a placeholder on the page and you can use style collection to set your attributes like width, height etc

Dim ctl As New Panel()
ctl.BackColor = Drawing.Color.Red
ctl.Style("Width") = 400
ctl.Style("Height") = 400
'or
ctl.CssClass = "YourCss"

PlaceHolder1.Controls.Add(ctl)

RossWal

5:39 pm on Dec 13, 2002 (gmt 0)

10+ Year Member



Thanks tomasz. The tool tip for myPanel.Style in VisualInterdev claims it to be only gettable, which is what threw me.