C
craigkenisston
I have a project, in which in my default.aspx page, I dinamically load
a user control in codebehind, in the pageload, that manages the website
:
Control objPageSkin = null;
HtmlForm objForm = new HtmlForm();
if (Settings.SomeCondition == true)
{
objPageSkin = LoadControl("_defaultall.ascx");
}
else if (Settings.SomeCondition == true)
{
objPageSkin = LoadControl("_defaultsingle.ascx");
}
Controls.Add(objPageSkin);
Now, in "_defaultall.ascx", I have some divs which have runat="server"
and have the proper id.
For example :
<div id="mainContent">
<!-- all content dinamically loaded here -->
</div>
Is rendered like this : !!
<div id="_ctl0_mainContent">
<!-- all content dinamically loaded here -->
</div>
(This unexpected change ruins my CSS and other code I have there, btw,
this code was running fine when I had it in an aspx file).
Why this happens ? How can I solve it ? And if it has no solution,
what's the proper approach here ? I'm open to any advise.
Thanks in advance,
a user control in codebehind, in the pageload, that manages the website
:
Control objPageSkin = null;
HtmlForm objForm = new HtmlForm();
if (Settings.SomeCondition == true)
{
objPageSkin = LoadControl("_defaultall.ascx");
}
else if (Settings.SomeCondition == true)
{
objPageSkin = LoadControl("_defaultsingle.ascx");
}
Controls.Add(objPageSkin);
Now, in "_defaultall.ascx", I have some divs which have runat="server"
and have the proper id.
For example :
<div id="mainContent">
<!-- all content dinamically loaded here -->
</div>
Is rendered like this : !!
<div id="_ctl0_mainContent">
<!-- all content dinamically loaded here -->
</div>
(This unexpected change ruins my CSS and other code I have there, btw,
this code was running fine when I had it in an aspx file).
Why this happens ? How can I solve it ? And if it has no solution,
what's the proper approach here ? I'm open to any advise.
Thanks in advance,