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


C# HtmlTextWriter.WriteEncodedText方法代码示例

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


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

示例1: WithBody

        public EmailBuilder WithBody(IEnumerable<KeyValuePair<string, IList>> lists)
        {
            var writer = new StringWriter();
            var html = new HtmlTextWriter(writer);

            html.RenderBeginTag(HtmlTextWriterTag.H1);
            html.WriteEncodedText(_viewModel.Subject);
            html.RenderEndTag();
            html.WriteBreak();
            html.WriteBreak();
            foreach (var list in lists)
            {
                html.RenderBeginTag(HtmlTextWriterTag.H3);
                html.WriteEncodedText(list.Key);
                html.RenderEndTag();
                html.RenderBeginTag(HtmlTextWriterTag.Ul);
                foreach (var item in list.Value)
                {
                    html.RenderBeginTag(HtmlTextWriterTag.Li);
                    html.WriteEncodedText(item.ToString());
                    html.RenderEndTag();
                }
                html.RenderEndTag();
                html.WriteBreak();
                html.WriteBreak();
            }

            _viewModel.Body = writer.ToString();

            return this;
        }
开发者ID:COTB,项目名称:k94warriors,代码行数:31,代码来源:EmailBuilder.cs

示例2: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "header");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Foreach");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.Argument);
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("in");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.Values);
            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Body");
            writer.RenderEndTag();

            writer.AddAttribute("class", "body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            this.Body.Render(writer);
            writer.RenderEndTag();
        }
开发者ID:jmangelo,项目名称:Inthros,代码行数:34,代码来源:ForEachView.cs

示例3: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteEncodedText(this.To);
            writer.RenderEndTag();

            writer.WriteEncodedText("=");

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteEncodedText(this.Value);
            writer.RenderEndTag();
        }
开发者ID:jmangelo,项目名称:Inthros,代码行数:14,代码来源:AssignView.cs

示例4: Render

        protected override void Render(HtmlTextWriter writer)
        {
            var errorMessages = GetErrorMessages().ToArray();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

            if (!errorMessages.Any()) {
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "display: none;");
            }

            using (writer.RenderTag(HtmlTextWriterTag.Div)) {
                if (!String.IsNullOrEmpty(HeaderText)) {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "header");
                    using (writer.RenderTag(HtmlTextWriterTag.Span)) {
                        writer.WriteEncodedText(HeaderText);
                    }
                }

                if (errorMessages.Any()) {
                    using (writer.RenderTag(HtmlTextWriterTag.Ul)) {
                        foreach (var message in errorMessages) {
                            if (message == null)
                                continue;

                            using (writer.RenderTag(HtmlTextWriterTag.Li)) {
                                writer.Write(message);
                            }
                        }
                    }
                }
            }
        }
开发者ID:devhost,项目名称:Corelicious,代码行数:33,代码来源:CustomValidationSummary.cs

示例5: Render

        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, string.Concat(ClientID, "-container"));
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "button");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);

            if ( NavigateUrl == null )
            {
                AddAttributesToRender(writer);
            }
            else
            {
                string path = NavigateUrl;
                string qs = string.Empty;
                int splitIndex = path.IndexOf('?');

                if ( splitIndex != -1 )
                {
                    path = NavigateUrl.Substring(0, splitIndex);
                    qs = NavigateUrl.Substring(splitIndex);
                }

                path = VirtualPathUtility.ToAbsolute(path);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Concat(path, qs));
            }

            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.WriteEncodedText(Text);
            writer.RenderEndTag();

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

示例6: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "header");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("CorrelatesWith");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.CorrelatesWith ?? string.Empty);
            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Body");
            writer.RenderEndTag();

            writer.AddAttribute("class", "body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            this.Body.Render(writer);
            writer.RenderEndTag();
        }
开发者ID:jmangelo,项目名称:Inthros,代码行数:25,代码来源:CorrelationScopeView.cs

示例7: RadioButton

        /// <summary>
        /// Renders the RadioButton
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="displayText">The display text.</param>
        /// <param name="radioButtonName">Name of the radio button.</param>
        /// <param name="radioButtonValue">The radio button value.</param>
        /// <param name="radioButtonId">The radio button id.</param>
        /// <param name="radioButtonIsChecked">if set to <c>true</c> [radio button is checked].</param>
        /// <param name="radioButtonHtmlAttributes">The radio button HTML attributes.</param>
        /// <returns></returns>
        public static string RadioButton(this HtmlHelper helper, string displayText, string radioButtonName, object radioButtonValue, string radioButtonId, bool radioButtonIsChecked, IDictionary<string, object> radioButtonHtmlAttributes)
        {
            var writer = new HtmlTextWriter(new StringWriter());

            writer.AddAttribute("for", radioButtonId);
            writer.RenderBeginTag(HtmlTextWriterTag.Label);

            writer.AddAttribute("type", "radio");
            writer.AddAttribute("id", radioButtonId);
            writer.AddAttribute("name", radioButtonName);
            writer.AddAttribute("value", radioButtonValue.ToString());

            if (radioButtonIsChecked)
            {
                writer.AddAttribute("checked", "checked");
            }

            foreach (var pair in radioButtonHtmlAttributes)
            {
                writer.AddAttribute(pair.Key, pair.Value.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Input);

            writer.RenderEndTag();

            writer.WriteEncodedText(displayText);

            writer.RenderEndTag();

            return writer.InnerWriter.ToString();
        }
开发者ID:bothaj,项目名称:JBSoft,代码行数:42,代码来源:RadioButtonHelper.cs

示例8: Render

		protected override void Render(HtmlTextWriter writer)
		{
			this.AddAttributes(writer);

			writer.AddAttribute(HtmlTextWriterAttribute.Style, "display:none");

			writer.RenderBeginTag(HtmlTextWriterTag.Input);
			writer.RenderEndTag();

			if(!string.IsNullOrWhiteSpace(this.Label))
			{
				writer.AddAttribute(HtmlTextWriterAttribute.For, this.ID + "_input");
				writer.RenderBeginTag(HtmlTextWriterTag.Label);
				writer.WriteEncodedText(this.Label);
				writer.RenderEndTag();
			}

			writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID + "_input");
			writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ID + "_input");
			writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
			writer.AddAttribute(HtmlTextWriterAttribute.Class, "file");
			writer.AddAttribute(HtmlTextWriterAttribute.Value, this.Value);

			if(!this.Enabled)
				writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");

			writer.RenderBeginTag(HtmlTextWriterTag.Input);
			writer.RenderEndTag();

			//调用基类同名方法
			base.Render(writer);
		}
开发者ID:Flagwind,项目名称:Zongsoft.Web,代码行数:32,代码来源:FileUpload.cs

示例9: Render

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

            if (!this.CheckRender())
                return;

            writer.AddAttribute(HtmlTextWriterAttribute.Class, string.IsNullOrEmpty(this.CssClass)
                                                                ? "iconGroup"
                                                                : this.CssClass);
            writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);

            writer.RenderBeginTag(HtmlTextWriterTag.Legend);
            writer.WriteEncodedText(this._menuItem.Text);
            writer.RenderEndTag(); // Legend

            foreach (Control c in this.Controls)
            {
                if (!(c is DynamicMenuChildControl))
                    continue;

                c.RenderControl(writer);
            }

            writer.RenderEndTag(); // Fieldset
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:29,代码来源:IconMenu.cs

示例10: Write

 public HtmlTextWriter Write(HtmlTextWriter writer)
 {
     if (_escape)
         writer.WriteEncodedText(_text);
     else
         writer.Write(_text);
     return writer;
 }
开发者ID:surgeforward,项目名称:LightBDD,代码行数:8,代码来源:TextBuilder.cs

示例11: RenderContents

 protected internal override void RenderContents(HtmlTextWriter writer)
 {
     string errorMessage = this.ErrorMessage;
     if (!string.IsNullOrEmpty(errorMessage))
     {
         writer.WriteEncodedText(System.Web.SR.GetString("ErrorWebPart_ErrorText", new object[] { errorMessage }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ErrorWebPart.cs

示例12: WriteTextInTag

		private static void WriteTextInTag(HtmlTextWriter writer, string tagName, string format, params string[] args)
		{
			string text = string.Format(format, args);

			writer.WriteFullBeginTag(tagName);
			writer.WriteEncodedText(text);
			writer.WriteEndTag(tagName);
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:8,代码来源:WfHtmlSimulationWriter.cs

示例13: RenderChildren

        protected override void RenderChildren(HtmlTextWriter writer)
        {
            try
            {
                base.RenderChildren(writer);
            }
            catch (HttpException ex)
            {
                writer.WriteFullBeginTag("div");
                writer.WriteFullBeginTag("h1");
                writer.WriteEncodedText("Error: Control could not be loaded");
                writer.WriteEndTag("h1");

                writer.WriteFullBeginTag("p");
                writer.WriteEncodedText(ex.Message);
                writer.WriteEndTag("p");
                writer.WriteEndTag("div");
            }
        }
开发者ID:radulazariciu,项目名称:Internship,代码行数:19,代码来源:ControlWrapper.aspx.cs

示例14: RenderDisplayName

 private void RenderDisplayName(HtmlTextWriter writer, string displayName, string associatedClientID)
 {
     if (this.Zone != null)
     {
         this.Zone.LabelStyle.AddAttributesToRender(writer, this);
     }
     writer.AddAttribute(HtmlTextWriterAttribute.For, associatedClientID);
     writer.RenderBeginTag(HtmlTextWriterTag.Label);
     writer.WriteEncodedText(displayName);
     writer.RenderEndTag();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:EditorPart.cs

示例15: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Duration");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.WriteEncodedText(this.Duration);
            writer.RenderEndTag();
        }
开发者ID:jmangelo,项目名称:Inthros,代码行数:11,代码来源:DelayView.cs


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