By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,778 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,778 IT Pros & Developers. It's quick & easy.

Need help with Style assignement to control.

P: n/a
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
-----------------------------------
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.