Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Rotator > RadRotator Does not appear on the sharepoint page when deployed through webpart
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered RadRotator Does not appear on the sharepoint page when deployed through webpart

Feed from this thread
  • Kamal Rangaraj avatar

    Posted on Oct 27, 2010 (permalink)

    Hi,

    I have radrotator which is working fine in webapplication but when that is converted into webpart and deployed into sharepoin this is not showing the radrotator on the page, i debugged it no error is thrown , only thing the radrotator does not appear on the page.

    below is the main code snippet,
     
    protected override void CreateChildControls()
            {
                base.CreateChildControls();
                 
               Panel panel = new Panel();
               panel.ID = "Panel1";
               this.Controls.Add(panel);
               RadRotator rrImageRotator = new RadRotator();
               rrImageRotator = new RadRotator();
               rrImageRotator.ID = "rrImageRotator";
               rrImageRotator.RotatorType = RotatorType.Carousel;
               rrImageRotator.Width = Unit.Pixel(650);
               rrImageRotator.Height = Unit.Pixel(250);
               rrImageRotator.ItemHeight = Unit.Pixel(250);
               rrImageRotator.ItemWidth = Unit.Pixel(250);
               rrImageRotator.ItemTemplate = new RadRotatorTemplate();
               rrImageRotator.DataSource = getDOCLib();
               rrImageRotator.DataBind();
               panel.Controls.Add(rrImageRotator);
               
               RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
               if (ajaxManager == null)
               {
                   ajaxManager = new RadAjaxManager();
                   ajaxManager.ID = "RadAjaxManager1";
                   Controls.Add(ajaxManager);
                   this.Page.Items.Add(typeof(RadAjaxManager), ajaxManager);
               }
               ajaxManager.AjaxSettings.AddAjaxSetting(rrImageRotator, panel);
     
               
            }
     
            
     
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                Page.ClientScript.RegisterStartupScript(typeof(SuccessStories), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
                if (this.Page.Form != null)
                {
                    string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
                    if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
                    {
                        this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
                    }
                }
     
                ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
                if (scriptManager == null)
                {
                    scriptManager = new RadScriptManager();
                    this.Page.Form.Controls.AddAt(0, scriptManager);
                }
            }
     
           
     
            public ArrayList getDOCLib()
            {
                //  SPSite Site = SPContext.Current.Site;
                SPSite Site = new SPSite("http://");
                SPWeb Web = Site.RootWeb;
                SPDocumentLibrary docLib = (SPDocumentLibrary)Web.Lists["Successful Customer Stories Images"];
                SPListItemCollection items = docLib.Items;
                ArrayList al = new ArrayList();
                foreach (SPListItem item in items)
                {
                    string strURL = "Image URL Come's here";               
                    //al.Add(item.File.ServerRelativeUrl);
                    al.Add(ResolveUrl(strURL));
     
                }
                return al;
            }
     
            public class RadRotatorTemplate : ITemplate
            {
                public RadRotatorTemplate() { }
     
                #region ITemplate Members
     
                public void InstantiateIn(Control container)
                {
                    LiteralControl lc1 = new LiteralControl("<div>");
                    container.Controls.Add(lc1);
                    Image img = new Image();
                    img.AlternateText = "Scusscess Stories";
                    img.Width = Unit.Pixel(250);
                    img.Height = Unit.Pixel(250);
                    img.DataBinding += img_DataBinding;
                    container.Controls.Add(img);
                    LiteralControl lc2 = new LiteralControl("</div>");
                    container.Controls.Add(lc2);
                }
     
                #endregion
     
                void img_DataBinding(object sender, EventArgs e)
                {
                    Image img = sender as Image;
                    RadRotatorItem template = img.NamingContainer as RadRotatorItem;
                    // template.ItemTemplate = new RadRotatorTemplate();
                    //// RadRotatorFrame frame = img.NamingContainer as RadRotatorFrame;
                    // img.ImageUrl = (string)frame.DataItem;
                    img.ImageUrl = (string)template.DataItem;
                }
            }
        }

  • Fiko Fiko avatar

    Posted on Nov 3, 2010 (permalink)

    Hi Kamal,

    I have noticed that you use a fairly outdated version of the controls. Could you please update to the recent version and let me know the result?

    Greetings,
    Fiko
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Rotator > RadRotator Does not appear on the sharepoint page when deployed through webpart