Пример #1
0
        public void Render(SingleViewRenderingContext renderingContext)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            RegisterAdjustViewScript(renderingContext);

            AddStandardAttributesToRender(renderingContext);
            if (string.IsNullOrEmpty(renderingContext.Control.CssClass) && string.IsNullOrEmpty(renderingContext.Control.Attributes["class"]))
            {
                renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassBase);
            }
            if (renderingContext.Control.IsDesignMode)
            {
                renderingContext.Writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
                renderingContext.Writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "75%");
            }
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            ScriptUtility.Instance.RegisterElementForBorderSpans(renderingContext.Control, "#" + renderingContext.Control.WrapperClientID);
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, renderingContext.Control.WrapperClientID);
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassWrapper);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            RenderTopControls(renderingContext);
            RenderView(renderingContext);
            RenderBottomControls(renderingContext);

            renderingContext.Writer.RenderEndTag();
            renderingContext.Writer.RenderEndTag();
        }
Пример #2
0
        private void RenderPlaceHolder(SingleViewRenderingContext renderingContext, Style style, PlaceHolder placeHolder, string defaultCssClass)
        {
            ScriptUtility.Instance.RegisterElementForBorderSpans(renderingContext.Control, "#" + placeHolder.ClientID);

            string cssClass = defaultCssClass;

            if (!string.IsNullOrEmpty(style.CssClass))
            {
                cssClass = style.CssClass;
            }

            if (placeHolder.Controls.Count == 0)
            {
                cssClass += " " + CssClassEmpty;
            }

            string backupCssClass = style.CssClass;

            style.CssClass = cssClass;
            style.AddAttributesToRender(renderingContext.Writer);
            style.CssClass = backupCssClass;

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, placeHolder.ClientID);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassContent);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            placeHolder.RenderControl(renderingContext.Writer);

            renderingContext.Writer.RenderEndTag();
            renderingContext.Writer.RenderEndTag();
        }
Пример #3
0
        protected virtual void RenderTopControls(SingleViewRenderingContext renderingContext)
        {
            ArgumentUtility.CheckNotNull("renderingContext", renderingContext);

            Style       style       = renderingContext.Control.TopControlsStyle;
            PlaceHolder placeHolder = renderingContext.Control.TopControl;
            string      cssClass    = CssClassTopControls;

            RenderPlaceHolder(renderingContext, style, placeHolder, cssClass);
        }
Пример #4
0
        private void RegisterAdjustViewScript(SingleViewRenderingContext renderingContext)
        {
            ScriptUtility.Instance.RegisterResizeOnElement(renderingContext.Control, string.Format("'#{0}'", renderingContext.Control.ClientID), "ViewLayout.AdjustSingleView");

            renderingContext.Control.Page.ClientScript.RegisterStartupScriptBlock(
                renderingContext.Control,
                typeof(SingleViewRenderer),
                Guid.NewGuid().ToString(),
                string.Format("ViewLayout.AdjustSingleView ($('#{0}'));", renderingContext.Control.ClientID));
        }
Пример #5
0
        private void RenderView(SingleViewRenderingContext renderingContext)
        {
            ScriptUtility.Instance.RegisterElementForBorderSpans(renderingContext.Control, "#" + renderingContext.Control.ViewClientID);

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, renderingContext.Control.ViewClientID);
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassView);
            renderingContext.Control.ViewStyle.AddAttributesToRender(renderingContext.Writer);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, renderingContext.Control.ViewContentClientID);
            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassContentBorder);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassContent);
            renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Div);

            renderingContext.Control.View.RenderControl(renderingContext.Writer);

            renderingContext.Writer.RenderEndTag();
            renderingContext.Writer.RenderEndTag();
            renderingContext.Writer.RenderEndTag();
        }