Need help with Style assignement to control.

K

Ken Varn

I have a WebControl in which I apply a Style using the ApplyStyle method.
This Style has Style.BackColor set to a valid color. When I pass it to the
Control.ApplyStyle() method, it seems to work fine on the first call.
However, if I try to apply a new Style object with no background color set,
the background color remains the same and is not removed.

Example:

{
Style MyStyle = new Style();

MyStyle.backColor = Color.Red;

MyControl.ApplyStyle(MyStyle);

MyStyle = new Style();
MyStyle.Reset();

MyStyle.ForeColor = Color.Black;

MyControl.ApplyStyle(MyStyle);

// At this point, if I render MyControl, the background color will still
be red. Why?
}

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 

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

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top