Need help with base.Style collection in custom control


N

Nick Goloborodko

Hi,

Here's my situation: I'm developing a custom control, which basically
consists of two nested <DIV> tags. Now, i need to obtain base.Style object,
in order to get the positioning information, if the control is being
positioned via ABSOLUTE positioning.

I have tried to used base.RenderBeginTag() and base.RenderEndTag() but the
the base tag is a <SPAN> an that goes against XHTML formatting rules.

So my question is: how do i either make a base tag s <DIV> tag instead of a
<SPAN>, or how do i obtain a valid inline CSS string from base.Style
preperty? (I tried base.Style.ToString() but that just returns the type of
the object. I also tried foreach loop on the object, but that collection
doesn't have an iterator defined)

TIA
Nick Goloborodko
 
Ad

Advertisements

W

Wilco Bauwer

You can derive from WebControl and one of the constructor overloads.
For example:

Code:
....
public MyControl() : base("div") {}
or
public MyControl() : base(HtmlTextWriterTag.Div) {}

HTH.
 
Ad

Advertisements

N

Nick Goloborodko

Wilco said:
You can derive from WebControl and one of the constructor overloads.
For example:

Code:
...
public MyControl() : base("div") {}
or
public MyControl() : base(HtmlTextWriterTag.Div) {}

HTH.

Thanks :) You've saved me alot of time :)
 

Top