private void Page_Load(Object sender, EventArgs e)
        {
            DNNUtilities.InjectCSS(Page, ResolveUrl("Resources/Support/edit.css"));


            Page.ClientScript.RegisterClientScriptInclude(GetType(), "yeti", ResolveUrl("resources/support/yetii-min.js"));


            if (Page.IsPostBack)
            {
                RenderParameterSettings();
            }
            else
            {
                SaveReferringPage();

                // drop down parameter type
                BindParameterType();
                BindParameter();

                // do parameter type
                RenderParameterSettings();
                RetrieveParameterSettings();
            }
        }
        private void InitReportSet()
        {
            // init stack for drilldown
            if (Session[DrilldownStackKey] == null)
            {
                _DrilldownStack = new ArrayListStack();
            }
            else
            {
                _DrilldownStack = (ArrayListStack)(Session[DrilldownStackKey]);
            }

            var objReportSetController = new ReportSetController();

            _ReportSet = objReportSetController.GetReportSetByModule(EffectiveModuleId);
            if (_ReportSet != null)
            {
                if (_ReportSet.ReportSetTheme != "None")
                {
                    DNNUtilities.InjectCSS(Page, ResolveUrl(string.Format("skins/{0}/styles.css", _ReportSet.ReportSetTheme)));
                }
                // get reports
                _Reports = objReportSetController.GetReportSetReport(ReportSet.ReportSetId);
            }
        }
        private void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                DotNetNuke.Framework.jQuery.RequestRegistration();
                if (ReportSet != null)
                {
                    if (ReportSet.RenderMode == RenderMode_Popup || ReportSet.RenderMode == RenderMode_NewWindow)
                    {
                        Page.ClientScript.RegisterClientScriptInclude(GetType(), "jquery.fancybox", ResolveUrl("resources/jQuery/FancyBox/jquery.fancybox-1.3.4.pack.js"));
                        Page.ClientScript.RegisterClientScriptInclude(GetType(), "jquery.sqlviewpro.fullscreen", ResolveUrl("resources/jQuery/jquery.sqlviewpro.fullscreen.js"));
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "sqlviewpro.object", string.Format("<script type=\"text/javascript\">sqlviewpro.fullScreenUrl = \'{0}\';</script>", FullscreenUrl()));
                        DNNUtilities.InjectCSS(Page, ResolveUrl("resources/jQuery/fancybox/jquery.fancybox-1.3.4.css"));
                    }
                    RenderModule();
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }

            // event handlers
            if (cmdAction != null)
            {
                cmdAction.Click += cmdAction_Click;
            }
            if (cmdBack != null)
            {
                cmdBack.Click += cmdBack_Click;
            }
        }
        private void Page_Load(Object sender, EventArgs e)
        {
            DNNUtilities.InjectCSS(Page, ResolveUrl("Resources/Support/edit.css"));



            if (!Page.IsPostBack)
            {
                BindConnection();
            }
        }
        private void Page_Init(Object sender, EventArgs e)
        {
            //CODEGEN: This method call is required by the Web Form Designer
            //Do not modify it using the code editor.
            InitializeComponent();

            // initialize
            ParameterId = int.Parse(DNNUtilities.QueryStringDefault(Request, "ParameterId", "-1"));
            ReportSetId = int.Parse(DNNUtilities.QueryStringDefault(Request, "ReportSetId", "-1"));

            InitParameter();
        }
        /// <summary>
        /// Injects Css for jQuery tabs Ui
        /// </summary>
        /// <param name="page"></param>
        /// <param name="preDnn6CssFile"></param>
        /// <param name="postDnn6CssFile"></param>
        /// <remarks>This method only gets run in pre-dnn6 installations.  Otherwise it uses the pre-defined DNN 6 Css declarations to style
        /// the UI Tabs</remarks>
        public static void InjectjQueryTabsCss(System.Web.UI.Page page, string preDnn6CssFile, string postDnn6CssFile)
        {
            var major    = default(int);
            var minor    = default(int);
            var build    = default(int);
            var revision = default(int);

            DNNUtilities.SafeDNNVersion(major, minor, revision, build);
            if (major < 6)
            {
                if (preDnn6CssFile != null && preDnn6CssFile != "")
                {
                    InjectCssReference(page, "moduleJqCss", preDnn6CssFile, true, CssInjectOrder.f_Last);
                }
                InjectCssReference(page, "jqueryUiTheme", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css", true, CssInjectOrder.f_Last);
            }
            if (major >= 6 && postDnn6CssFile != null && postDnn6CssFile != "")
            {
                InjectCssReference(page, "moduleJqCss", postDnn6CssFile, true, CssInjectOrder.c_BeforeSkin);
            }
        }
        private void Page_Load(System.Object sender, System.EventArgs e)
        {
            DNNUtilities.InjectCSS(Page, ResolveUrl("Resources/Support/edit.css"));
            Page.ClientScript.RegisterClientScriptInclude(GetType(), "yeti", ResolveUrl("resources/support/yetii-min.js"));

            if (Request.QueryString["ReportSetId"] != null)
            {
                ReportSetId = int.Parse(Request.QueryString["ReportSetId"].ToString());
            }
            else
            {
                ReportSetId = -1;
            }

            if (!Page.IsPostBack)
            {
                BindSkinFolder(cboSkin);
                LoadReportSet();

                SaveReferringPage();
            }
        }
        private void Page_Load(Object sender, EventArgs e)
        {
            DNNUtilities.InjectCSS(Page, ResolveUrl("Resources/Support/edit.css"));


            try
            {
                cmdImport.Attributes.Add("onclick", "return confirm(\'Importing will overwrite the current reportset associated with this module. Are you sure?\');");

                if (Page.IsPostBack == false)
                {
                    LoadSettings();
                }
            }
            catch (Exception exc)             //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }

            cmdCancel.Click += cmdCancel_Click;
            cmdImport.Click += cmdImport_Click;
        }
        private void Page_Load(Object sender, EventArgs e)
        {
            DNNUtilities.InjectCSS(Page, ResolveUrl("Resources/Support/edit.css"));
            Page.ClientScript.RegisterClientScriptInclude(GetType(), "yeti", ResolveUrl("resources/support/yetii-min.js"));

            if (Page.IsPostBack)
            {
                RenderReportSettings();
            }
            else
            {
                SaveReferringPage();

                // drop down report type
                BindReportType();
                BindDrilldownReport();
                BindSkinFolder(cboSkin);
                BindReport();

                // do report type
                RenderReportSettings();
                RetrieveReportSettings();
            }
        }
        /// <summary>
        /// Includes the jQuery libraries onto the page
        /// </summary>
        /// <param name="page">Page object from calling page/control</param>
        /// <param name="includejQueryUI">if true, includes the jQuery UI libraries</param>
        /// <param name="debug">if true, includes the uncompressed libraries</param>
        public static void InjectjQueryLibary(System.Web.UI.Page page, bool includejQueryUI, bool debug)
        {
            var major             = default(int);
            var minor             = default(int);
            var build             = default(int);
            var revision          = default(int);
            var injectjQueryLib   = false;
            var injectjQueryUiLib = false;

            if (DNNUtilities.SafeDNNVersion(major, minor, revision, build))
            {
                switch (major)
                {
                case 4:
                    injectjQueryLib   = true;
                    injectjQueryUiLib = true;
                    break;

                case 5:
                    injectjQueryLib   = false;
                    injectjQueryUiLib = true;
                    break;

                default:
                    //6.0 and above
                    injectjQueryLib   = false;
                    injectjQueryUiLib = false;
                    break;
                }
            }
            else
            {
                injectjQueryLib = true;
            }

            if (injectjQueryLib)
            {
                //no in-built jQuery libraries into the framework, so include the google version
                string lib = null;
                if (debug)
                {
                    lib = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js";
                }
                else
                {
                    lib = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
                }

                if (page.Header.FindControl("jquery") == null)
                {
                    var jQueryLib = new System.Web.UI.HtmlControls.HtmlGenericControl("script");
                    jQueryLib.Attributes.Add("src", lib);
                    jQueryLib.Attributes.Add("type", "text/javascript");
                    jQueryLib.ID = "jquery";
                    page.Header.Controls.Add(jQueryLib);

                    // use the noConflict (stops use of $) due to the use of prototype with a standard DNN distro
                    var noConflictScript = new System.Web.UI.HtmlControls.HtmlGenericControl("script");
                    noConflictScript.InnerText = " jQuery.noConflict(); ";
                    noConflictScript.Attributes.Add("type", "text/javascript");
                    page.Header.Controls.Add(noConflictScript);
                }
            }
            else
            {
                //call DotNetNuke.Framework.jQuery.RequestRegistration();
                var jQueryType = Type.GetType("DotNetNuke.Framework.jQuery, DotNetNuke");
                if (jQueryType != null)
                {
                    //run the DNN 5.0 specific jQuery registration code
                    jQueryType.InvokeMember("RequestRegistration", (BindingFlags)(BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static), null, jQueryType, null);
                }
            }

            //include the UI libraries?
            if (includejQueryUI)
            {
                if (injectjQueryUiLib)
                {
                    // if you want to use a local version (ie, not CDN) here's where you would change it)

                    string lib = null;
                    if (debug)
                    {
                        lib = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js";
                    }
                    else
                    {
                        lib = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js";
                    }
                    page.ClientScript.RegisterClientScriptInclude("jqueryUI", lib);
                }
                else
                {
                    //use late bound call to request registration of jquery
                    var jQueryType = Type.GetType("DotNetNuke.Framework.jQuery, DotNetNuke");
                    if (jQueryType != null)
                    {
                        //dnn 6.0 and later, allow jquery ui to be loaded from the settings.

                        jQueryType.InvokeMember("RequestUIRegistration", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, jQueryType, null);
                    }
                }
            }
        }
        /// <summary>
        /// Inject a reference to a CSS file into the page
        /// </summary>
        /// <param name="page">The current page object</param>
        /// <param name="name">the name of the css file - should be unique</param>
        /// <param name="file">the css file location - can be absolute or relative.</param>
        /// <param name="inHeader">true if css to be included in header, false if not</param>
        /// <param name="cssOrder">Where to include the css file in relation to the DNN css files - applies to DNN 6.1 installs only</param>
        public static void InjectCssReference(System.Web.UI.Page page, string name, string file, bool inHeader, CssInjectOrder cssOrder)
        {
            var major    = default(int);
            var minor    = default(int);
            var build    = default(int);
            var revision = default(int);
            var useDotNetNukeWebClient = false;
            var dnnWebClientOk         = false;

            if (DNNUtilities.SafeDNNVersion(major, minor, revision, build))
            {
                if (major >= 6)
                {
                    if (major == 6 && minor < 1)
                    {
                        useDotNetNukeWebClient = false;
                    }
                    else
                    {
                        useDotNetNukeWebClient = true;
                    }
                }
            }
            if (useDotNetNukeWebClient)
            {
                //use reflection to inject the css reference
                var priority = GetCssPriority(cssOrder);
                //get the imbibe type
                var imbibe = Type.GetType("DotNetNuke.Web.Client.ClientResourceManagement.ClientResourceManager, DotNetNuke.Web.Client");
                if (imbibe != null)
                {
                    //reflection call
                    //ClientResourceManager.RegisterScript(Page page, string filePath, int priority) // default provider
                    var paramTypes  = new Type[4];
                    var paramValues = new object[4];
                    paramTypes[0]  = typeof(System.Web.UI.Page);
                    paramValues[0] = page;
                    paramTypes[1]  = typeof(string);
                    paramValues[1] = file;
                    paramTypes[2]  = typeof(int);
                    paramValues[2] = priority;
                    paramTypes[3]  = typeof(string);
                    if (inHeader && inHeader)
                    {
                        paramValues[3] = "PageHeaderProvider";
                    }
                    else
                    {
                        paramValues[3] = "DnnBodyProvider";
                    }
                    //call the method to register the script via reflection
                    var registerStyleSheetMethod = imbibe.GetMethod("RegisterStyleSheet", paramTypes);
                    if (registerStyleSheetMethod != null)
                    {
                        registerStyleSheetMethod.Invoke(null, paramValues);
                        //worked OK
                        dnnWebClientOk = true;
                    }
                }
            }
            //not on DNN 6.1, so use direct method to inject the header / body.
            //note that outcome position is pot luck based on calling code.
            if (!useDotNetNukeWebClient || dnnWebClientOk == false)
            {
                if (page.Header.FindControl(name) == null)
                {
                    //764 : xhtml compliance by using html link control which closes tag without separate closing tag
                    var cssFile = new System.Web.UI.HtmlControls.HtmlLink();
                    cssFile.Attributes.Add("rel", "stylesheet");
                    cssFile.Attributes.Add("href", file);
                    cssFile.Attributes.Add("type", "text/css");
                    cssFile.ID = name;
                    page.Header.Controls.Add(cssFile);
                }
                else
                {
                    if (page.FindControl(name) == null)
                    {
                        var cssFile = new System.Web.UI.HtmlControls.HtmlLink();
                        cssFile.Attributes.Add("rel", "stylesheet");
                        cssFile.Attributes.Add("href", file);
                        cssFile.Attributes.Add("type", "text/css");
                        cssFile.ID = name;
                        page.Controls.Add(cssFile);
                    }
                }
            }
        }
        /// <summary>
        /// Inject a js Library reference into the page
        /// </summary>
        /// <param name="page">The page object of the page to add the script reference to</param>
        /// <param name="name">Unique name for the script</param>
        /// <param name="lib">Url to the script library (can be relative/absolute)</param>
        /// <param name="inHeader">True if to go in the page header, false if to go into the page body</param>
        /// <param name="scriptPosition">Enumerated position for calculating where to place the script.  Works for DNN 6.1 and later only, ignored in earlier versions</param>
        public static void InjectJsLibrary(System.Web.UI.Page page, string name, string lib, bool inHeader, ScriptInjectOrder scriptPosition)
        {
            var major                  = default(int);
            var minor                  = default(int);
            var build                  = default(int);
            var revision               = default(int);
            var allowInHeader          = false;
            var useDotNetNukeWebClient = false;
            var dnnWebClientOk         = false;

            if (DNNUtilities.SafeDNNVersion(major, minor, revision, build))
            {
                switch (major)
                {
                case 4:
                case 5:
                    allowInHeader = true;
                    break;

                default:
                    //6.0 and above
                    if (minor >= 1)
                    {
                        //6.1 and abpve
                        if (revision < 1)
                        {
                            //6.1.0 - work with change in order that means no placement of scripts in header
                            allowInHeader          = false;
                            useDotNetNukeWebClient = true;
                        }
                        else
                        {
                            //6.1.1 and above - use client dependency framework
                            useDotNetNukeWebClient = true;
                        }
                    }
                    else
                    {
                        //6.0
                        allowInHeader = true;
                    }
                    break;
                }
            }

            if (useDotNetNukeWebClient)
            {
                //use the dotnetnuke web client methods
                var priority = GetScriptPriority(scriptPosition);
                //get the imbibe type
                var imbibe = Type.GetType("DotNetNuke.Web.Client.ClientResourceManagement.ClientResourceManager, DotNetNuke.Web.Client");
                if (imbibe != null)
                {
                    //create arrays of both types and values for the parameters, in readiness for the reflection call
                    var paramTypes  = new Type[4];
                    var paramValues = new object[4];
                    paramTypes[0]  = typeof(System.Web.UI.Page);
                    paramValues[0] = page;
                    paramTypes[1]  = typeof(string);
                    paramValues[1] = lib;
                    paramTypes[2]  = typeof(int);
                    paramValues[2] = priority;
                    paramTypes[3]  = typeof(string);
                    if (inHeader && allowInHeader)
                    {
                        paramValues[3] = "PageHeaderProvider";
                    }
                    else
                    {
                        paramValues[3] = "DnnBodyProvider";
                    }
                    //call the method to register the script via reflection
                    var registerScriptMethod = imbibe.GetMethod("RegisterScript", paramTypes);
                    if (registerScriptMethod != null)
                    {
                        registerScriptMethod.Invoke(null, paramValues);
                        //worked OK
                        dnnWebClientOk = true;
                    }
                }
            }

            if (!useDotNetNukeWebClient || dnnWebClientOk == false)
            {
                //earlier versions or failed with reflection call, inject manually
                if (inHeader && allowInHeader)
                {
                    if (page.Header.FindControl(name) == null)
                    {
                        var jsLib = new System.Web.UI.HtmlControls.HtmlGenericControl("script");
                        jsLib.Attributes.Add("src", lib);
                        jsLib.Attributes.Add("type", "text/javascript");
                        jsLib.ID = name;
                        page.Header.Controls.Add(jsLib);
                    }
                }
                else
                {
                    //register a script block - doesn't go in the header
                    if (page.ClientScript != null)
                    {
                        page.ClientScript.RegisterClientScriptInclude(name, lib);
                    }
                }
            }
        }
        private Control ApplyReportLayout(string reportLayout)
        {
            var reportControls = ParseControl(reportLayout);

            var reportContainer = FindControlRecursive(reportControls, "pnlReportContainer");

            // state
            var state = (DrilldownState)(_DrilldownStack.Peek());

            state.PortalId  = PortalId;
            state.ModuleId  = EffectiveModuleId;
            state.TabId     = TabId;
            state.UserId    = UserId;
            state.ReportSet = ReportSet;

            foreach (ReportInfo objReport in Reports)
            {
                if (objReport.ReportDrilldownReportId == state.FromReportId && objReport.ReportDrilldownFieldname == state.FromReportColumn)                 // show only if proper drilldown level
                {
                    // override theme if nothing
                    if (string.IsNullOrEmpty(objReport.ReportTheme))
                    {
                        objReport.ReportTheme = ReportSet.ReportSetTheme;
                    }

                    if (objReport.ReportTheme != "None")
                    {
                        DNNUtilities.InjectCSS(Page, ResolveUrl(string.Format("skins/{0}/styles.css", objReport.ReportTheme)));
                    }

                    // override connection string if necessary
                    if (objReport.ReportConnectionId == (int)ConnectionType.ReportSetDefault)
                    {
                        objReport.ReportConnectionId     = ReportSet.ReportSetConnectionId;
                        objReport.ReportConnectionString = ReportSet.ReportSetConnectionString;
                    }

                    // add to page
                    var objReportBase = (ReportControlBase)(LoadControl(ResolveUrl(objReport.ReportTypeControlSrc)));
                    objReportBase.ID            = "ReportBase" + objReport.ReportId.ToString();
                    objReportBase.FullScreenUrl = FullscreenUrl();
                    objReportBase.LoadRuntimeSettings(objReport);

                    // handlers
                    objReportBase.OnDrillDown += OnDrilldown;

                    objReportBase.State  = state;
                    objReportBase.Report = objReport;

                    // add report wrapper and then add this to report set wrapper
                    var ctrl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                    ctrl.Attributes.Add("class", objReport.ReportTheme + "_Report");

                    var headerMarkup = objReportBase.RenderHeaderAsText();
                    var footerMarkup = objReportBase.RenderFooterAsText();

                    // header
                    if (headerMarkup != "")
                    {
                        ctrl.Controls.Add(ParseControl(headerMarkup));
                    }
                    // report
                    ctrl.Controls.Add(objReportBase);
                    // footer
                    if (footerMarkup != "")
                    {
                        ctrl.Controls.Add(ParseControl(footerMarkup));
                    }


                    reportContainer.Controls.Add(ctrl);
                }
            }

            return(reportControls);
        }