Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Adding style to a control

I have a Panel and I am adding controls inside this panel. But there is a specific control that I would like to float. How would I go about doing that?

pnlOverheadDetails is the panel name

pnlOverheadDetails.Controls.Add(lnkCalcOverhead);

The control named lnkCalcOverhead is the control I'd like to float.

Thanks in advance

EDIT: By float I meant the css style not anything fancy :)

like image 300
Mike Fielden Avatar asked Nov 14 '08 13:11

Mike Fielden


1 Answers

If you have a CSS class defined for the control, you could do this before calling the Controls.Add method:

lnkCalcOverhead.CssClass = "MyClass";

If you want to use the style attribute directly, try this:

lnkCalcOverhead.Style.Add("float", "left");
like image 106
Jeromy Irvine Avatar answered Oct 28 '22 05:10

Jeromy Irvine