Custom Server controls

  • Thread starter Thread starter Prasanna
  • Start date Start date
P

Prasanna

Hi all,

Does anyone tell me how to set the width of a custom server control. Because
my server control comes in a small box forcing some of it's elements to jump
into new lines.

Thanks in advance.

Prasanna.
 
I assume you're talking about ASP.NET. You can add an explicit width to an
html element by either setting the Width property on the control - if it
exposes one, or by manually adding the CSS (which Width translates to when
available).

myTopLevelElement.Attributes.Add("style","width:300px");

or you can add the Nowrap attribute to table cells which will stop the
contained text from breaking onto another line.

Or you can set an explicit width attribute on a table without having to use
css. <table width="400"> is 400 pixels. If there is CSS on top of that I
think it might override the html attribute, but I'm not 100% sure about
that.

hth
Leon
 
Back
Top