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


C# HtmlTextWriter.RenderTag方法代码示例

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


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

示例1: 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

示例2: DoRender

		/// <summary>
		/// Renders the output of the control
		/// </summary>
		/// <param name="output">The response writer.</param>
		protected override void DoRender(HtmlTextWriter output)
		{
			using (output.RenderTag(
				HtmlTextWriterTag.Script,
				new HtmlAttribute(HtmlTextWriterAttribute.Type, "text/javascript"),
				new HtmlAttribute(HtmlTextWriterAttribute.Src, this.GetAbsoluteUrl(this.Src))))
			{
				// nothing needed inside.
			}
		}
开发者ID:sitecorerick,项目名称:constellation.sitecore.seo,代码行数:14,代码来源:StaticJavascriptReference.cs

示例3: RenderContents

        /// <summary>
        /// Renders the contents of the control to the specified writer. This method is used primarily by control developers.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (this.EventArgs != null) {

                writer.RenderTag(HtmlTextWriterTag.Legend, "Server side rendered content");

                // start address/location
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#EEE");
                using (writer.BeginTag(HtmlTextWriterTag.Div)) {
                    writer.RenderTag(HtmlTextWriterTag.B, "Start address: ");
                    writer.Write(this.EventArgs.StartAddress);
                    writer.RenderTag(HtmlTextWriterTag.B, " / Start location: ");
                    writer.Write(this.EventArgs.StartLocation.ToString());
                }

                // steps
                foreach (var step in this.EventArgs.Steps) {
                    writer.AddStyleAttribute("border-bottom", "solid 1px #CCC");
                    using (writer.BeginTag(HtmlTextWriterTag.Div)) {
                        writer.Write(step.Instructions);
                        writer.Write(" | ");
                        writer.RenderTag(HtmlTextWriterTag.B, "Distance: ");
                        writer.Write(step.Distance.Text);
                        writer.Write(" | ");
                        writer.RenderTag(HtmlTextWriterTag.B, "Duration: ");
                        writer.Write(step.Duration.Text);
                    }
                }

                // end address/location
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#EEE");
                using (writer.BeginTag(HtmlTextWriterTag.Div)) {
                    writer.RenderTag(HtmlTextWriterTag.B, "End address: ");
                    writer.Write(this.EventArgs.EndAddress);
                    writer.RenderTag(HtmlTextWriterTag.B, " / End location: ");
                    writer.Write(this.EventArgs.EndLocation.ToString());
                }

                // distance
                using (writer.BeginTag(HtmlTextWriterTag.Div)) {
                    writer.RenderTag(HtmlTextWriterTag.B, "Total Distance: ");
                    writer.Write(this.EventArgs.Distance.Text);
                }
                // durarion
                using (writer.BeginTag(HtmlTextWriterTag.Div)) {
                    writer.RenderTag(HtmlTextWriterTag.B, "Total Duration: ");
                    writer.Write(this.EventArgs.Duration.Text);
                }
            }
        }
开发者ID:ziad007,项目名称:URI2,代码行数:54,代码来源:RouteRenderer.cs

示例4: RenderServiceOptions

        /// <summary>
        /// The render service options.
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="controlId">
        /// The control id.
        /// </param>
        protected void RenderServiceOptions(HtmlTextWriter output, string source, string controlId)
        {
            // TODO: Ed, this appears to be very CW centric, can we make it more generalized in name?
            var current = Client.GetItemNotNull(this.ItemID, global::Sitecore.Context.ContentDatabase);
            var siteItem = current.Axes.SelectSingleItem("ancestor-or-self::*[contains(@@templatename, 'Site')]");

            var luceneQuery = source.Replace("lucene:", string.Empty);

            var qh = new QueryStringHelper(luceneQuery);

            var templateid = qh.GetByName("templateid");
            var fullSiteSearch = false;

            if (qh.NameExists("fullsite"))
            {
                fullSiteSearch = qh.GetByName<bool>("fullsite");
            }

            using (output.RenderTag(HtmlTextWriterTag.Script, new HtmlAttribute("type", "text/javascript")))
            {
                output.WriteLine("jQuery(\"#{0}\").tokenInput(\"/tokenizedlisthandler.axd\", ".FormatWith(controlId));

                output.WriteLine("{theme: \"facebook\", ");
                output.WriteLine("tokenDelimiter: \"|\", ");
                output.WriteLine("preventDuplicates: true, ");
                output.WriteLine("makeSortable: true, ");
                output.WriteLine("minChars: 3,");
                output.WriteLine("luceneFullSite: \"{0}\",".FormatWith(fullSiteSearch));
                output.WriteLine("luceneLanguage: \"{0}\",".FormatWith(this.ItemLanguage));
                if (siteItem != null && !fullSiteSearch)
                {
                    output.WriteLine("luceneSiteName: \"{0}\",".FormatWith(siteItem.Key));
                }

                if (!string.IsNullOrEmpty(templateid))
                {
                    output.WriteLine("luceneTemplateId: \"{0}\",".FormatWith(templateid));
                }

                output.WriteLine("parseName: function(item) { ");
                output.WriteLine("    if (typeof item.site !== \"undefined\") { ");
                output.WriteLine("		if (item.site == null) { ");
                output.WriteLine("			return \"Unmatched People >\" + item.name; ");
                output.WriteLine("		} else {");
                output.WriteLine("      return item.site + \" >\" + item.name; ");
                output.WriteLine("		} ");
                output.WriteLine("	  } ");
                output.WriteLine("	  return item.name; ");
                output.WriteLine("}, ");
                output.WriteLine("disabled: " + this.Disabled.ToString().ToLowerInvariant());

                if (fullSiteSearch)
                {
                    this.RenderValueWithSite(output);
                }
                else
                {
                    this.RenderValue(output);
                }

                output.WriteLine("});");
            }
        }
开发者ID:WizX20,项目名称:spark-sitecore-client,代码行数:75,代码来源:TokenizedList.cs

示例5: RenderManualOptions

        /// <summary>
        /// The render manual options.
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="controlId">
        /// The control id.
        /// </param>
        protected void RenderManualOptions(HtmlTextWriter output, string source, string controlId)
        {
            // TODO: Ed, this appears to be very CW centric, can we make it more generalized in name?
            var current = Client.GetItemNotNull(this.ItemID, global::Sitecore.Context.ContentDatabase);

            var items = this.GetItems(current, this.Source);

            using (output.RenderTag(HtmlTextWriterTag.Script, new HtmlAttribute("type", "text/javascript")))
            {
                output.WriteLine("jQuery(\"#{0}\").tokenInput([".FormatWith(controlId));
                foreach (var item in items)
                {
                    var langItem = item.GetBestFitLanguageVersion(Language.Parse(this.ItemLanguage));
                    output.WriteLine("{{id: \"{0}\", name: {1}}},".FormatWith(langItem.ID, StringUtil.EscapeJavascriptString(langItem.DisplayName)));
                }

                output.WriteLine("],");
                output.WriteLine("{theme: \"facebook\", ");
                output.WriteLine("tokenDelimiter: \"|\", ");
                output.WriteLine("preventDuplicates: true, ");
                output.WriteLine("makeSortable: true, ");
                output.WriteLine("disabled: " + this.Disabled.ToString().ToLowerInvariant());

                this.RenderValue(output);

                output.WriteLine("});");
            }
        }
开发者ID:WizX20,项目名称:spark-sitecore-client,代码行数:40,代码来源:TokenizedList.cs


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