当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTextWriter.BeginRender方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlTextWriter.BeginRender方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.BeginRender方法的具体用法?C# HtmlTextWriter.BeginRender怎么用?C# HtmlTextWriter.BeginRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlTextWriter的用法示例。


在下文中一共展示了HtmlTextWriter.BeginRender方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoRender

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        protected override void DoRender(HtmlTextWriter output)
        {
            LanguageCollection languageCollection = LanguageManager.GetLanguages(Sitecore.Context.Database);

            output.BeginRender();

            if (languageCollection.Any())
            {
                output.AddAttribute(HtmlTextWriterAttribute.Class, "pickLanguage");
                output.RenderBeginTag(HtmlTextWriterTag.P);

                foreach (Language language in languageCollection)
                {
                    Sitecore.Data.ID contextLanguageId = LanguageManager.GetLanguageItemId(language, Sitecore.Context.Database);
                    Item contextLanguage = Sitecore.Context.Database.GetItem(contextLanguageId);

                    string iso = contextLanguage.Fields["Regional Iso Code"].Value;
                    if (string.IsNullOrEmpty(iso))
                    {
                        iso = contextLanguage["Iso"];
                    }
                    output.AddAttribute(HtmlTextWriterAttribute.Href, String.Format("?sc_lang={0}", iso));
                    output.RenderBeginTag(HtmlTextWriterTag.A);
                    output.WriteLine(FieldRenderer.Render(contextLanguage, "Display Image", "mw=20"));
                    output.RenderEndTag();
                }

                output.RenderEndTag();
            }

            output.EndRender();
        }
开发者ID:hainguyen4c,项目名称:BasicSitecoreSample,代码行数:36,代码来源:LanguageSwitcher.cs

示例2: Render

        protected override void Render(HtmlTextWriter writer)
        {
            writer.BeginRender();
            writer.AddAttribute("class", this.CssClass);
            base.Render(writer);

            writer.EndRender();
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:8,代码来源:BindableLookUp.cs

示例3: Render

        //***************************************************************************
        // Private Methods
        // 
        protected override void Render(HtmlTextWriter writer)
        {
            this.EnsureChildControls();

            writer.BeginRender();
            try
            {
                FormElementControl.AddElementStyleAttributes(writer, this._qData);
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                for (int y = 0; y < this.RowCount; y++)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    for (int x = 0; x < this.ColumnCount; x++)
                    {
                        FormElementData[] cellData = this._qData.Children.Where(c => c.RowIndex == y && c.ColumnIndex == x).ToArray();

                        if (cellData.Length > 1)
                            // If we found more than one, I don't even want to try and
                            //   figure out how to handle that one right now.
                            throw new Exception(string.Format("Row {0}, Column {1} of the grid contains more than one child cell definition. Cannot render more than one cell in each row/column intersect position.", y + 1, x + 1));

                        else if (cellData.Length < 1)
                        {
                            // If no child cell is found at this intersection, just render
                            //   an empty table cell, so we don't "break" the HTML output.
                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            writer.RenderEndTag();
                        }

                        else if (cellData[0].DisplayType != FormElementDisplayType.GridCell)
                            // If the item we found isn't for a grid cell, that's a problem.
                            //   I'm not coding around that "weirdness".  At least not yet.
                            throw new Exception(string.Format("Cannot render a form element of type {0} directly below a Grid element without a parent GridCell.  Please check your data for correct parent/child hierarchy.", cellData[0].DisplayType));

                        else
                        {
                            // We've got data for a single cell, so create a control.
                            FormElementControl ctrl = FormElementControl.GetControl(cellData[0]);
                            this.Controls.Add(ctrl);
                            ctrl.RenderControl(writer);
                        }
                    }
                    writer.RenderEndTag(); // TR
                }

                writer.RenderEndTag(); // TABLE
            }
            finally
            { writer.EndRender(); }
            base.Render(writer);
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:55,代码来源:FormElementGrid.cs

示例4: Render

        /// <summary>
        /// Shows the localized text string (if available)
        /// </summary>
        /// <param name="output">
        /// </param>
        protected override void Render(HtmlTextWriter output)
        {
            output.BeginRender();

            if (!this.DesignMode)
            {
                output.Write(this.LocalizeAndRender(this));
            }
            else
            {
                output.Write("[{0}][{1}]", this.LocalizedPage, this.LocalizedTag);
            }

            output.EndRender();
        }
开发者ID:RH-Code,项目名称:YAFNET,代码行数:20,代码来源:LocalizedLabel.cs

示例5: Render

 /// <summary>
 /// Shows the localized text string (if available)
 /// </summary>
 /// <param name="writer">
 /// </param>
 protected override void Render(HtmlTextWriter writer)
 {
   writer.BeginRender();
   writer.Write(this.LocalizeAndRender(this));
   writer.EndRender();
 }
开发者ID:vzrus,项目名称:VZF,代码行数:11,代码来源:LocalizedLabel.cs

示例6: RenderPage

        /// <summary>
        /// Render the HTML for the admin page to the response.
        /// </summary>
        /// <param name="response">The <see cref="HttpResponse"/> to render the page to.</param>
        private void RenderPage( HtmlTextWriter writer )
        {
            writer.BeginRender();
            writer.RenderBeginTag(HtmlTextWriterTag.Html);

            // Write HTML header.
            writer.RenderBeginTag(HtmlTextWriterTag.Head);
            writer.RenderBeginTag(HtmlTextWriterTag.Title);
            writer.Write("FEMAH");
            writer.RenderEndTag( /* Title */ );
            writer.RenderEndTag( /* Head */ );

            // Write page header.
            writer.RenderBeginTag(HtmlTextWriterTag.Body);
            writer.RenderBeginTag(HtmlTextWriterTag.H1);
            writer.Write("FEMAH");
            writer.RenderEndTag(/* H1 */);

            // Render all feature switches.
            var features = Core.Femah.AllFeatures();
            if (features.Count == 0)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("There are no feature switches.");
                writer.RenderEndTag(/* P */);
            }
            else
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                foreach (var feature in features.OrderBy( f => f.Name))
                {
                    RenderFeatureRow(writer, feature);
                }
                writer.RenderEndTag(/* Table */);
            }

            writer.RenderEndTag(/* Body */);
            writer.RenderEndTag(/* Html */);
            writer.EndRender();
        }
开发者ID:hotstone,项目名称:femah,代码行数:44,代码来源:FemahHttpHandler.cs

示例7: Render

        public void Render(HtmlTextWriter writer)
        {
            if (this.Text != "-")
            {
                writer.BeginRender();
                writer.AddAttribute("role", "menuitem");
                if (this.Enabled == false)
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "");
                if (this.HasAttributes)
                {
                    this.Attributes.AddAttributes(writer);
                }

                if (this.Value != null)
                    writer.AddAttribute("data-value", this.Value);

                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(this.Text); // 注意,不会自动转义的
                writer.RenderEndTag();
                writer.EndRender();
            }
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:22,代码来源:DeluxeMenuStripItem.cs

示例8: Render

        //***************************************************************************
        // Override Methods
        // 
        protected override void Render(HtmlTextWriter writer)
        {
            writer.BeginRender();
            try
            {
                // Get the filename for the currently executing page.
                string curPgNm = System.IO.Path.GetFileName(this.Context.Request.PhysicalPath).Trim().ToLower();

                StringBuilder sb = new StringBuilder("chevron.axd");

                sb.AppendFormat("?h={0}&spc={1}", this._itemHeight, this._itemSpc);
                if (this._itemWidth != -1)
                    sb.AppendFormat("&itmw={0}", this._itemWidth);
                else
                    sb.AppendFormat("&w={0}", this._totalWidth);
                sb.AppendFormat("&fnt={0}&fsz={1}&tpd={2}", this.FontName, this.FontSize.Unit.Value, this.FontPadding);
                sb.AppendFormat("&bld={0}&itl={1}&twp={2}", (this.FontBold ? 1 : 0), (this.FontItalic ? 1 : 0), (this.TextWrap ? 1 : 0));
                sb.AppendFormat("&tClr={0}&bClr={1}&fClr={2}", Hex.GetWebColor(this.ItemBackColor1).TrimStart('#'), Hex.GetWebColor(this.ItemBackColor2).TrimStart('#'), Hex.GetWebColor(this.ForeColor).TrimStart('#'));
                sb.AppendFormat("&bdrClr={0}&atClr={1}&abClr={2}", Hex.GetWebColor(this.BorderColor).TrimStart('#'), Hex.GetWebColor(this.ActiveItemBackColor1).TrimStart('#'), Hex.GetWebColor(this.ActiveItemBackColor2).TrimStart('#'));
                sb.AppendFormat("&ctClr={0}&cbClr={1}", Hex.GetWebColor(this.CompleteItemBackColor1).TrimStart('#'), Hex.GetWebColor(this.CompleteItemBackColor2).TrimStart('#'));
                sb.AppendFormat("&acMd={0}&acOp={2}&bckClr={1}", (int)this._accentMode, Hex.GetWebColor(this.BackColor).TrimStart('#'), this._accentBaseOpac);
                //sb.AppendFormat("&bvl={2}", this.Bevel);
                sb.AppendFormat("&bdrWdt={0}", this.BorderWidth);
                sb.AppendFormat("&bckTrns={0}&cmpTrns={1}&actTrns={2}&bdrTrns={3}", this.ItemAlpha, this.CompletedItemAlpha, this.ActiveItemAlpha, this.BorderAlpha);
                sb.AppendFormat("&tsOn={0}", (this.TextShadow ? 1 : 0));
                if (this.TextShadow)
                    sb.AppendFormat("&tsOp={0}", this.TextShadowAlpha);

                if (!string.IsNullOrEmpty(this.CustomShapeFileUrl))
                    sb.AppendFormat("&shpFl={0}", this.CustomShapeFileUrl);
                if (!string.IsNullOrEmpty(this.CustomShapeName))
                    sb.AppendFormat("&shpNm={0}", this.CustomShapeName);

                int actIdx = -1;
                List<string> parts = new List<string>();
                List<string> imgs = new List<string>();
                if (this._itemsCol.Count > 0)
                {
                    for (int i = 0; i < this._itemsCol.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(this._itemsCol[i].AssocPageName) && this._itemsCol[i].AssocPageName.Split('|').Any(s => s.Trim().ToLower() == curPgNm))
                            this._itemsCol[i].IsActive = true;

                        parts.Add(Context.Server.UrlEncode(this._itemsCol[i].Text));
                        if (this._itemsCol[i].IsActive)
                            actIdx = i;
                        if (this._itemsCol[i].ImageSrc != null)
                        {
                            string imgUrl = this._itemsCol[i].ImageSrc.OriginalString;
                            if (!this._itemsCol[i].ImageSrc.IsAbsoluteUri && !VirtualPathUtility.IsAbsolute(imgUrl))
                                imgUrl = VirtualPathUtility.ToAbsolute(imgUrl);
                            imgs.Add(Context.Server.UrlEncode(imgUrl));
                        }
                        else
                            imgs.Add(Context.Server.UrlEncode(" "));
                    }
                    if (actIdx == -1)
                    {
                        actIdx = 0;
                        this._itemsCol[0].IsActive = true;
                    }
                }
                sb.AppendFormat("&act={0}", actIdx);
                sb.AppendFormat("&pcs={0}", string.Join("|", parts.ToArray()));
                sb.AppendFormat("&img={0}", string.Join("|", imgs.ToArray()));

                string url = sb.ToString();
                if (url.Length > 2000)
                    throw new Exception("Chevron handler URL exceeds 2000 characters.");

                writer.AddAttribute(HtmlTextWriterAttribute.Src, url);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            finally
            { writer.EndRender(); }
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:80,代码来源:ChevronHeader.cs

示例9: BeginRender

 protected internal virtual void BeginRender(HtmlTextWriter writer)
 {
     writer.BeginRender();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:ControlAdapter.cs

示例10: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            base.RenderContents(writer);

            writer.BeginRender();
            writer.AddAttribute("class", valueClass ?? "value");
            writer.AddAttribute("id", ValueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            object renderedValue = value;
            if (RenderValue != null)
            {
                renderedValue = RenderValue(value);
            }

            if (renderedValue != null)
            {
                if (outputFormat == null)
                {
                    renderedValue = renderedValue.ToString();
                }
                else
                {
                    renderedValue = string.Format(outputFormat, renderedValue);
                }
            }
            else
            {
                renderedValue = nullValue;
            }

            if (renderedValue != null)
            {
                if (this.encodeValue)
                {
                    writer.WriteEncodedText((string )renderedValue);
                }
                else
                {
                    writer.Write(renderedValue);
                }
            }

            writer.RenderEndTag();
            writer.EndRender();
        }
开发者ID:andy-uq,项目名称:Echo,代码行数:46,代码来源:Value.cs

示例11: Render

        /// <summary>
        /// Shows the localized text string (if available)
        /// </summary>
        /// <param name="output">The output.</param>
        protected override void Render(HtmlTextWriter output)
        {
            output.BeginRender();

            var text = this.GetText(this.LocalizedPage, this.LocalizedTag)
                    .FormatWith(this.Param0, this.Param1, this.Param2);

            if (text.IsSet() && text.EndsWith(":"))
            {
                text = text.Remove(text.Length - 1, 1);
            }

            // Write Title
            output.Write(text);

            // Append Suffix
            if (this.Suffix.IsSet())
            {
                output.Write(this.Suffix);
            }

            var tooltip = this.GetText(this.LocalizedPage, this.LocalizedHelpTag)
                .FormatWith(this.ParamHelp0, this.ParamHelp1, this.ParamHelp2);

            tooltip = tooltip.IsSet() ? this.HtmlEncode(tooltip) : text;

            output.Write(
                "&nbsp;<button type=\"button\" class=\"btn btn-primary btn-circle\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"{0}\"><i class=\"fa fa-question\"></i></button>",
                tooltip);

            output.EndRender();
        }
开发者ID:Pathfinder-Fr,项目名称:YAFNET,代码行数:36,代码来源:HelpLabel.cs

示例12: RenderContents

 protected override void RenderContents(HtmlTextWriter writer)
 {
     base.RenderContents(writer);
     writer.Write(string.Format("<tbody><tr><td class=\"Message\">{0}</td></tr></tbody>", Message));
     writer.BeginRender();
 }
开发者ID:robgray,项目名称:f1speedguides,代码行数:6,代码来源:MessagePanel.cs

示例13: Render

 /// <summary>
 /// Shows the localized text string (if available)
 /// </summary>
 /// <param name="output">
 /// </param>
 protected override void Render(HtmlTextWriter output)
 {
   output.BeginRender();
   output.Write(this.LocalizeAndRender(this));
   output.EndRender();
 }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:11,代码来源:LocalizedLabel.cs

示例14: FillTextBox

        private void FillTextBox()
        {
            var buffer = new StringWriter();
            using (var html = new HtmlTextWriter(buffer))
            {
                html.RenderBeginTag("html");
                html.RenderBeginTag(HtmlTextWriterTag.Head);

                html.RenderBeginTag(HtmlTextWriterTag.Style);
                html.BeginRender();
                html.Write(Properties.Resources.ResizableTextAreaStyle);
                html.EndRender();
                html.RenderEndTag();//style

                html.RenderEndTag();//head
                html.RenderBeginTag("body");

                html.RenderBeginTag("h1");
                html.WriteEncodedText(string.Format("{0}.{1}", verb.EntityName, verb.Name));
                html.RenderEndTag();

                html.RenderBeginTag("table");
                html.RenderBeginTag("tbody");

                foreach (var verbArgument in verb.Arguments)
                {
                    html.RenderBeginTag("tr");

                    html.RenderBeginTag("td");
                    html.WriteEncodedText(verbArgument.Name);
                    html.RenderEndTag();

                    html.RenderBeginTag("td");
                    switch (verbArgument.Type.ToLowerInvariant())
                    {
                        case "system.string":
                        case "system.int64":
                        case "system.int32":
                        case "system.int16":
                        case "system.byte":
                        case "system.boolean":
                        case "system.datetime":
                            html.AddAttribute(HtmlTextWriterAttribute.Id, "arg" + verbArgument.Position);
                            html.AddAttribute(HtmlTextWriterAttribute.Type, "text");
                            html.RenderBeginTag(HtmlTextWriterTag.Input);
                            html.RenderEndTag();
                            break;

                        default:
                            html.AddAttribute(HtmlTextWriterAttribute.Name, "outerDiv");
                            html.AddAttribute(HtmlTextWriterAttribute.Class, "outerDiv");
                            html.RenderBeginTag(HtmlTextWriterTag.Div);

                            html.AddAttribute(HtmlTextWriterAttribute.Class, "txtArea");
                            html.AddAttribute(HtmlTextWriterAttribute.Id, "arg" + verbArgument.Position);
                            html.RenderBeginTag(HtmlTextWriterTag.Textarea);
                            html.WriteEncodedText(verbArgument.XmlTemplate ?? "No template available");
                            html.RenderEndTag();//textarea

                            html.AddAttribute(HtmlTextWriterAttribute.Class, "corner");
                            html.RenderBeginTag(HtmlTextWriterTag.Div);
                            html.RenderEndTag(); //innerdiv

                            html.RenderEndTag();//outerdiv
                            break;
                    }

                    html.RenderEndTag();

                    html.RenderBeginTag("td");
                    html.WriteEncodedText(verbArgument.Type);
                    html.RenderEndTag();

                    html.RenderEndTag(); // tr
                }

                html.RenderEndTag(); // tbody
                html.RenderEndTag(); // table

                html.AddAttribute(HtmlTextWriterAttribute.Type, "button");
                html.AddAttribute(HtmlTextWriterAttribute.Id, "invoke");
                html.AddAttribute(HtmlTextWriterAttribute.Value, "Invoke");
                html.RenderBeginTag(HtmlTextWriterTag.Input);
                html.RenderEndTag();

                html.RenderEndTag(); // body
                html.RenderEndTag(); // html
            }

            webBrowser1.DocumentText = buffer.ToString();
        }
开发者ID:rbramwell,项目名称:OrionSDK,代码行数:91,代码来源:InvokeVerbTab.cs

示例15: Render

        /// <summary>
        /// Renders the JBST control reference and any stored data to be used.
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            writer.BeginRender();
            try
            {
                // render any named data items
                if (this.dataItems != null && this.dataItems.Count > 0)
                {
                    new DataBlockWriter(this.EnsureAutoMarkup()).Write(writer, this.dataItems);
                }

                // generate an ID for controls which do not have explicitly set
                this.EnsureID();
                this.Jbst.ID = this.ClientID;
                this.Jbst.IsDebug = this.IsDebug;

                // render JBST
                if (this.HasControls())
                {
                    this.Jbst.Write(writer, this.InlineData, this.Index, this.Count, this.RenderChildrenCallback);
                }
                else
                {
                    this.Jbst.Write(writer, this.InlineData, this.Index, this.Count);
                }
            }
            finally
            {
                writer.EndRender();
            }
        }
开发者ID:pocket-playlab,项目名称:jsonfx-v1,代码行数:35,代码来源:Control.cs


注:本文中的System.Web.UI.HtmlTextWriter.BeginRender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。