RadWindow - Base Part

2 posts, 0 answers
  1. Lucas
    Lucas avatar
    3 posts
    Member since:
    Aug 2008

    Posted 04 Apr 2009 Link to this post

    I have developed a quick base part for using the radwindowmanager on a sharepoint site.  My requirement was to have various webparts that could open a rad window from links, such as news and events.  Here is my base class.   What do you think? The skin is hardcoded, but that could easily be changed.  I have found that this seems to work pretty well for what I am trying to do. 

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI;
    using System.Reflection;
    using Telerik.Web.UI;
    using Telerik.Charting.Styles;

    namespace SunGard.Portal.WebParts.Controls {
        public class BaseWindowPart : System.Web.UI.WebControls.WebParts.WebPart {
            private const string javascriptIncludeKey = "SunGardPortalWebPartsClientScript";
            private const string javascriptFilePath = "SunGardPortalWebPartsClientScript.js";
            private RadWindowManager windowManager;
            private RadWindow popupWindow;

            protected string radWindowClientName = "SPRadWindow";

            protected override void OnLoad(EventArgs e) {
                ClientScriptManager cs = Page.ClientScript;
                if (!cs.IsClientScriptIncludeRegistered(typeof(Page), javascriptIncludeKey)) {
                    string scriptUrl = cs.GetWebResourceUrl(this.GetType(), String.Format("{0}.{1}", Assembly.GetExecutingAssembly().GetName().Name, javascriptFilePath));
                    cs.RegisterClientScriptInclude(typeof(Page), javascriptIncludeKey, scriptUrl);
                }
                base.OnLoad(e);
            }

            protected override void CreateChildControls() {
                base.CreateChildControls();
                if (Page.FindControl("SPRadWindow") == null) {
                    windowManager = new RadWindowManager();
                    windowManager.ID = "SPRadWindow";
                    windowManager.Skin = "WebBlue";

                    Controls.Add(windowManager);
                    popupWindow = new RadWindow();
                    popupWindow.ReloadOnShow = true;
                    Controls.Add(popupWindow);
                }
            }
        }}
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 07 Apr 2009 Link to this post

    Hello Lucas,

    The code seems OK and you should not experience problems with it. Of course if any problem arise, we are ready to help you with it.

    Greetings,
    Georgi Tunev
    the Telerik team

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

Back to Top