UpdatePanel in masterPage in Wcsf enable/Disable problem

Sep 7, 2007 at 12:36 PM
Hi,

I have to add the Updatepanel to the Master page in which the DefultContenPanel have to be in it, base on some condition .
If the condition is flase then the UpdatePanel should not work,
Here is the code .of MasterPage

protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.Application"Javascript".Equals("Enabled"))
{
MasterUpdatePanel.Visible = true;
UpdatePanel up1 = new UpdatePanel();
up1.ID = "MasterUpdatePanel";
up1.UpdateMode = UpdatePanelUpdateMode.Conditional;
ContentPlaceHolder contentplaceholder = new ContentPlaceHolder();
contentplaceholder.ID = "DefaultContent";
up1.ContentTemplateContainer.Controls.Add(DefaultC ontent);
Page.Form.Controls.Add(up1);
}
else
{
Panel panel = new Panel();
panel.ID = "Panel1";
panel.Width = Unit.Percentage(100);
panel.Height = Unit.Percentage(100);
ContentPlaceHolder DefaultContent = new ContentPlaceHolder();
DefaultContent.ID = "DefaultContent";
panel.Controls.Add(DefaultContent);
}
}
But when run the application the "DefaultContent" is note found Error is displayed.by the Internet Browser,
First the .aspx page is loaded then the Page_load function is called,
So is there any way i can do it in master page, so that i can decide in runtime, where the ContenPlaceHolde ie"DefaultContent" should be .

Thanks in adavances.

Anil S G