Re: Dynamically setting a MasterPage's <body> tag style



"John Timney (MVP)" <x_john@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:-OGdnVaY_MH7lSjZRVnyvg@xxxxxxxxxxxxxxxxx

To hazard a guess (I dont have a dev environment handy) could it be
because you have called your generic control and your body server control
the same names objBody, and your telling findcontrol to look for itself

Nope - I already thought of that and changed the variable name, but that
made no difference.

Incidentally, doing the whole thing in one long line doesn't generate the
error... e.g.

This generates the error, on the first line:

HtmlGenericControl HTMLBody =
(HtmlGenericControl)Master.FindControl("objBody");
HTMLBody .Attributes.Add("style", "background-image:
url(images/skylinelogo.gif);");

But this doesn't:

((HtmlGenericControl)Master.FindControl("objBody")).Attributes.Add("style",
"background-image: url(images/skylinelogo.gif);");

Both work perfectly...

This has really piqued my curiosity now! Can anyone shed any light on what's
happening here...?


.