Using RadDatePicker in Sharepoint WebPart popup doesn't work

2 posts, 0 answers
  1. Marshall Scipio
    Marshall Scipio avatar
    2 posts
    Member since:
    May 2006

    Posted 09 Dec 2010 Link to this post

    I have followed the example that was laid out in previous posts of how to integrate RadControls into Sharepoint and basically, they compile and everything, but when I go to display the webpart, anything that needs to 'fire' doesn't work, e.g. buttons, actions, etc.

    So for purposes of demonstrations, I have stripped down to a very basic webpart that simply has only one RadDatePicker in it.

    using System;
    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Serialization;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;
    using Telerik.Web.UI;
    namespace InternalControls.WebParts.RadControlTest
        public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
            public WebPart1()
            protected override void OnInit(EventArgs e)
                Page.ClientScript.RegisterStartupScript(typeof(WebPart1), 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 sm = ScriptManager.GetCurrent(this.Page);
                if (sm == null)
                    sm = new RadScriptManager();
                    Controls.AddAt(0, sm);
            protected override void OnLoad(EventArgs e)
                Panel panel = new Panel();
                panel.ID = "Panel1";
                RadDatePicker rdp = new RadDatePicker();
                rdp.PopupDirection = DatePickerPopupDirection.BottomRight;
                rdp.Calendar.Enabled = true;
                RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
                if (ajaxManager == null)
                    ajaxManager = new RadAjaxManager();
                    ajaxManager.ID = "RadAjaxManager1";
                    this.Page.Items.Add(typeof(RadAjaxManager), ajaxManager);
                ajaxManager.AjaxSettings.AddAjaxSetting(rdp, panel);

    As I said, it will compile and deploy, but when the webpart surfaces the popup button for the calendar doesn't work.  In other words clicking on the popup button does nothing, where as if this were not in a webpart the calendar would be displayed.

    Can anyone please help me with this, I have been trying various things for several days.


  2. Tsvetoslav
    Tsvetoslav avatar
    1823 posts

    Posted 11 Dec 2010 Link to this post

    Hello Marshall,

    Try changing the following line:

    Controls.AddAt(0, sm); 

    this.Page.Form.Controls.AddAt(0, scriptManager);

    and make sure that you have the RadScriptManager handler registered in the web.config for the MOSS applciation:

    Hope it helps.

    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top