Archive for September, 2008

LinkButton (or any ASP.NET server control) has Inline Style Added From Nowhere

September 13, 2008

Of course this can never happen.

Inline styles do not ‘come from nowhere’.

But when my LinkButtons kept rendering with inline style color:#267fb7 text-decoration:none and I couldn’t see any Skins file, I started to wonder.

After 43 mins of pain I finally found where the inline style was coming from. Naturally, it was a Skins file that I hadn’t seen because three quarters of my brain has been eaten by maggots rendering me left with the basic congnition of Prokaryotic Protein.

Am I Not Mental Enough ?
What I had actually done before was inspect the Skins file of a completely different Solution File.
Yes, I am mental enough to do that.

Once I had inspected the correct Skins file for a change, I found this:

asp:LinkButton runat=”server” Font-Underline=”false” ForeColor=”#267fb7″ onmouseover=”’#0b5c91′;” onmouseout=”’#267fb7′;” /

Cunning observers amongst you will have already noticed that the ForeColor is set to #267fb7 which is where
my mystery coloration had come from, along with font-Underline=false, rendering as text-decoration: none.

Yes, so, if you have mystery display attributes being injected from nowhere into your server controls, then look in the
correct Skins file, i.e. the one in your Solution, not the one in a completely different solution. The latter is unlikely to help

Here’s a gratuitous link to a sub-beginner level article on Skins files that should keep you and me amused for a couple of aeons.

Please note I only confess to the above in order to save you the same trouble. Look, I found the solution without Googling it, at least.