コード例 #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer); // always call Render first to set styles and attributes

            controlToRender.TagName = "img";
            controlToRender.Attributes.Add("src", this.InitialImageSource);
            controlToRender.Attributes.Add("id", this.DomId);
            controlToRender.RenderControl(writer);

            JsonFunction function = new JsonFunction();
            // name, outimage, overimage
            string functionBody = string.Format("JSUI.QueueSwapifyConfig(JSUI.construct(\"ToggleConfig\", ['{0}', '{1}', '{2}', '{3}', '{4}']));", this.JsonId, this.InitialImageSource, this.ToggleImageSource, this.InitialImageEvent, this.ToggleImageEvent);

            functionBody += string.Format("\r\nJSUI.SetToggleImage('{0}', '{1}');", this.DomId, this.JsonId);
            //functionBody += string.Format("\r\nJSUI.ImageSwapify('{0}', '{0}');", this.JsonId);

            if (this.SetHandCursor)
            {
                functionBody += string.Format("\r\nJSUI.SetHandCursor('{0}');", this.DomId);
            }

            function.FunctionBody  = functionBody;
            function.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
            this.AddJsonFunction(function);
            if (RenderScripts)
            {
                function.RenderControl(writer);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            controlToRender.Attributes.Add("id", this.DomId);
            controlToRender.Attributes.Add("jsonid", this.JsonId);
            if (PopulateInline)
            {
                if (string.IsNullOrEmpty(this.VirtualBoxPath))
                {
                    throw new JsonInvalidOperationException("The VirtualBoxPath property was not set or the BoxName specified could not be found.");
                }

                controlToRender.Controls.Add(new LiteralControl(BoxServer.GetHtmlString(this.VirtualBoxPath)));
            }

            controlToRender.RenderControl(writer);

            if (PopulateOnPageLoad)
            {
                JsonFunction retrieveBoxContentScript = new JsonFunction();
                retrieveBoxContentScript.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
                retrieveBoxContentScript.FunctionBody  = string.Format("DataBox.GetBoxContent('{0}', '{1}');", this.DomId, this.BoxName);
                retrieveBoxContentScript.RenderControl(writer);
            }
        }
コード例 #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer); // always call Render first to set styles and attributes

            controlToRender.TagName = "img";
            controlToRender.Attributes.Add("src", this.InitialImageSource);
            controlToRender.Attributes.Add("id", this.DomId);
            controlToRender.RenderControl(writer);

            JsonFunction function = new JsonFunction();
            // name, outimage, overimage
            string functionBody = string.Format("JSUI.QueueSwapifyConfig(JSUI.construct(\"ToggleConfig\", ['{0}', '{1}', '{2}', '{3}', '{4}']));", this.JsonId, this.InitialImageSource, this.ToggleImageSource, this.InitialImageEvent, this.ToggleImageEvent);
            functionBody += string.Format("\r\nJSUI.SetToggleImage('{0}', '{1}');", this.DomId, this.JsonId);
            //functionBody += string.Format("\r\nJSUI.ImageSwapify('{0}', '{0}');", this.JsonId);

            if (this.SetHandCursor)
                functionBody += string.Format("\r\nJSUI.SetHandCursor('{0}');", this.DomId);

            function.FunctionBody = functionBody;
            function.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
            this.AddJsonFunction(function);
            if (RenderScripts)
            {
                function.RenderControl(writer);
            }
        }