Custom Server controls

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.
 
L

Leon Jollans

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top