SharePoint Web Part with Rad Controls is NOT working

2 posts, 0 answers
  1. Sai
    Sai avatar
    2 posts
    Member since:
    Jan 2009

    Posted 21 Jan 2009 Link to this post


    Recently, we bought ASP.NET AJAX telerik controls. Installed Telerik Controls Q3 2008 (default installation) in a server where MOSS is installed and now, wanted to use these controls in the SharePoint sites. I followed the guidelines for usage of these controls but not very much clear for me to use from SharePoint web part or any other component. To test the usage, I did a sample but facing problem.

    I created a web part for MOSS by following the guidelines provided at

    I used Visual Studio 2005 with extensions for Windows SharePoint Services.
    In the Visual Studio 2005, I created a project for SharePoint Web Part and used the code from your guidelines.

    Steps followed for Telerik Controls Installation and web part development:
    a. Telerik Controls installation in the SharePoint environment:  I installed the telerik controls by using set up Automatic Install RadControls_for_ASP.NET_AJAX_2008_3_1125_dev.exe.
    b. Telerik installed the controls in the default location C:\Program Files\Telerik\RadControls for ASPNET AJAX Q3 2008
    c. Deployed the Telerik.Web.UI.dll in GAC from C:\Program Files\Telerik\RadControls for ASPNET AJAX Q3 2008\Bin folder.
    d. Followed the guidelines mentioned in  and
    e. Developed the web part (code provided below).
    f. Deployed the web part  (web part created the required safecontrol entry for web part dll).

    The web part is using RadTreeView control. On clicking the tree node "What's the time?", the web part should show the current time in the place of "This is a label".  But, the time is not shown and not able to click the tree node.  I checked all the configuration settings for ASP.NET Ajax and also guildelines for Telerik control usage.  Not sure why this web part is not working?

    Any help is appreciated and blocked on usage of these controls enterprize level.

    Here is my code:

    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 ITSUS_ITrInno_TelerikWebPart
        public class TelerikWebPart : System.Web.UI.WebControls.WebParts.WebPart
            public TelerikWebPart()

            Label label;

            protected override void OnInit(EventArgs e)

                Page.ClientScript.RegisterStartupScript(typeof(TelerikWebPart), 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);

            protected override void OnLoad(EventArgs e)
                Panel panel = new Panel();
                panel.ID = "Panel1";
                RadTreeView treeView = new RadTreeView();
                treeView.ID = "RadTreeView1";
                treeView.Nodes.Add(new RadTreeNode("What's the time?"));
                treeView.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick);
                label = new Label();
                label.Text = "This is a label";
                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(treeView, panel);

            void treeView_NodeClick(object sender, RadTreeNodeEventArgs e)
                label.Text = DateTime.Now.ToLongTimeString();

            protected override void CreateChildControls()

                // TODO: add custom rendering code here.
                // Label label = new Label();
                // label.Text = "Hello World";
                // this.Controls.Add(label);

  2. Dimitar Milushev
    Dimitar Milushev avatar
    555 posts

    Posted 26 Jan 2009 Link to this post

    Hello Sai,

    I tested your Web Part code and it seems to work as expected. You should make sure that everything is configured properly in your Sharepoint installation - you have the MOSS Service Pack installed, the AJAX extensions are installed etc. It's a lengthy process and it's easy to miss a step.

    Dimitar Milushev
    the Telerik team

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

Back to Top