In addition to Deepak's suggestion, you might look at the LoadControl and
use a placeholder. Something like this should work:
string controlName;
if (whatever)
{
controlName = "Content1.ascx";
}
else
{
controlName = "Content2.ascx";
}
this.myPlaceHolder.Controls.Add(LoadControl(contro lName));
--
Michael Giagnocavo
MVP
www.atrevido.net
"Lubo¹ ©lapák" <lu**********@centrum.cz> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have the main page "default.aspx". I have also UserControls
"content1.ascx" and "content2.ascx". How can I write in "default.aspx"
this:
if true then
show content1.ascx
else
show content2.ascx
I know I create in HTML code of "default.aspx" this line:
'<content1:content1 id="content" runat="server" />' then in the page is
the
content1, but how can i manage this dynamically?