Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

UPDATE

  protected override void CreateChildControls()
        {
            if (!this._error)
            {
                try
                {
                    base.CreateChildControls();

                    UpdatePanel updatePanel1 = new UpdatePanel();
                    updatePanel1.ID = "udpItemListingWebPart";
                    updatePanel1.UpdateMode = UpdatePanelUpdateMode.Conditional;

                    ContentService_VWPUserControl control = Page.LoadControl(_ascxPath) as MyUserControl_VWPUserControl; 

                    if (control != null)
                        control.WebPart = this;
                    //Controls.Add(control);
                    updatePanel1.ContentTemplateContainer.Controls.Add(control);
                }
                catch (Exception ex)
                {
                    this.HandleException(ex);
                }
            }
        }

END UPDATE

the below code is suppose to work but somehow if i have UpdatePanel then it does not render... no error nothing just dont render the web site in my case (http://www.cnn.com) any help?

protected override void OnPreRender(EventArgs e)
{

 base.OnPreRender(e);

UpdatePanel updatePanel1 = new UpdatePanel();
updatePanel1.ID = "udpItemListingWebPart";
updatePanel1.UpdateMode = UpdatePanelUpdateMode.Conditional; 
PageViewerWebPart oWebPart = new PageViewerWebPart();
oWebPart.ContentLink = "http://www.cnn.com"; 
updatePanel1.ContentTemplateContainer.Controls.Add(oWebPart);

}
share|improve this question
add comment

2 Answers

finally i figured out and below is the updated code: hope this will help others..

protected override void CreateChildControls()
        {
            if (!this._error)
            {
                try
                {
                    base.CreateChildControls();

                    UpdatePanel updatePanel1 = new UpdatePanel();
                    updatePanel1.ID = "udpItemListingWebPart";
                    updatePanel1.UpdateMode = UpdatePanelUpdateMode.Conditional;

                    ContentService_VWPUserControl control = Page.LoadControl(_ascxPath) as MyUserControl_VWPUserControl; 

                    if (control != null)
                        control.WebPart = this;
                    //Controls.Add(control);
                    updatePanel1.ContentTemplateContainer.Controls.Add(control);
                    this.Controls.Add(updatePanel1);
                }
                catch (Exception ex)
                {
                    this.HandleException(ex);
                }
            }
        }
share|improve this answer
add comment

You need to create the updatepanel in CreateChildControls instead of prerender and add it to the controls collection for it to work correctly.

share|improve this answer
    
i changed it to CreateChildControls still the same, I have updated my question –  Abu Hamzah Sep 8 '11 at 18:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.