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


C# HtmlTextWriter.WriteBeginTag方法代码示例

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


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

示例1: RenderOptionGroupBeginTag

 private void RenderOptionGroupBeginTag(string name, HtmlTextWriter writer)
 {
     writer.WriteBeginTag("optgroup");
     writer.WriteAttribute("label", name);
     writer.Write(HtmlTextWriter.TagRightChar);
     writer.WriteLine();
 }
开发者ID:atiburrahman09,项目名称:Signbd,代码行数:7,代码来源:DropDownListAdapter.cs

示例2: RenderBeginTag

 protected override void RenderBeginTag(HtmlTextWriter writer)
 {
     TreeView tree = Control as TreeView;
     writer.WriteBeginTag("ul");
     if(tree.CssClass != null)
         writer.WriteAttribute("class", tree.CssClass);
     writer.Write(HtmlTextWriter.TagRightChar);
 }
开发者ID:maleadt,项目名称:stockplay,代码行数:8,代码来源:TreeViewCustomAdapter.cs

示例3: RenderBeginTag

 protected override void RenderBeginTag(HtmlTextWriter writer)
 {
     Console.Write(Control);
     SiteMapPath path = Control as SiteMapPath;
     writer.WriteBeginTag("p");
     if (path.CssClass != "")
         writer.WriteAttribute("class", path.CssClass);
     writer.Write(HtmlTextWriter.TagRightChar);
 }
开发者ID:maleadt,项目名称:stockplay,代码行数:9,代码来源:SiteMapPathCustomAdapter.cs

示例4: RenderSiteMapNode

 private void RenderSiteMapNode(HtmlTextWriter writer, SiteMapPath path, SiteMapNode node)
 {
     writer.WriteBeginTag("a");
     if(node.Url != "")
         writer.WriteAttribute("href", node.Url);
     if (node.Description != "")
         writer.WriteAttribute("title", node.Description);
     writer.Write(HtmlTextWriter.TagRightChar);
     writer.Write(node.Title);
     writer.WriteEndTag("a");
 }
开发者ID:maleadt,项目名称:stockplay,代码行数:11,代码来源:SiteMapPathCustomAdapter.cs

示例5: RenderNodes

    private void RenderNodes(HtmlTextWriter writer, TreeNodeCollection children)
    {
        writer.Indent++;
        foreach (TreeNode subnode in children)
        {
            writer.WriteLine();
            writer.WriteBeginTag("li");
            writer.Write(HtmlTextWriter.TagRightChar);

            if (subnode.NavigateUrl != null)
            {
                writer.WriteBeginTag("a");
                if(subnode.NavigateUrl != "")
                    writer.WriteAttribute("href", subnode.NavigateUrl);
                if(subnode.ToolTip != "")
                    writer.WriteAttribute("title", subnode.ToolTip);
                writer.Write(">");
                writer.Write(subnode.Text);
                writer.WriteEndTag("a");
            }

            writer.WriteEndTag("li");

            if (subnode.ChildNodes.Count != 0)
            {
                writer.WriteLine();
                writer.WriteBeginTag("ul");
                writer.WriteAttribute("class", "TreeViewSubmenu");
                writer.Write(HtmlTextWriter.TagRightChar);
                RenderNodes(writer, subnode.ChildNodes);
                writer.WriteEndTag("ul");
            }
        }
        writer.Indent--;
        writer.WriteLine();
    }
开发者ID:maleadt,项目名称:stockplay,代码行数:36,代码来源:TreeViewCustomAdapter.cs

示例6: RenderListItem

        private void RenderListItem(ListItem item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("option");
            writer.WriteAttribute("value", item.Value, true);

            if (item.Selected)
            {
                writer.WriteAttribute("selected", "selected", false);
            }

            foreach (string key in item.Attributes.Keys)
            {
                writer.WriteAttribute(key, item.Attributes[key]);
            }

            writer.Write(HtmlTextWriter.TagRightChar);
            HttpUtility.HtmlEncode(item.Text, writer);
            writer.WriteEndTag("option");
            writer.WriteLine();
        }
开发者ID:atiburrahman09,项目名称:Signbd,代码行数:20,代码来源:DropDownListAdapter.cs

示例7: RenderPostBackEvent

        /// <devdoc>
        ///    <para>Renders a client widget corresponding to a postback event, for example a wml do or a post link.   Note that this
        ///     widget may not submit the form data, e.g. scriptless html where this renders a link. </para>
        /// </devdoc>
        protected void RenderPostBackEvent(HtmlTextWriter writer, string target, string argument, string softkeyLabel, string text, string postUrl, string accessKey, bool encode) {
            // Default: render postback event as scriptless anchor (works for all markups).  Override for specific markups.
            string amp = encode ? "&amp;" : "&";

            bool isCrossPagePostBack = !String.IsNullOrEmpty(postUrl);
            writer.WriteBeginTag("a");
            writer.Write(" href=\"");
            string url = null;
            if (!isCrossPagePostBack) {
                if ((String)Browser["requiresAbsolutePostbackUrl"] == "true") {
                    url = Page.Response.ApplyAppPathModifier(Page.Request.CurrentExecutionFilePath);
                }
                else {
                    url = Page.RelativeFilePath;
                }
            }
            else {
                url = postUrl;
                Page.ContainsCrossPagePost = true;
            }

            writer.WriteEncodedUrl(url);
            writer.Write("?");

            string clientState = ClientState;
            if (clientState != null)
            {
                ICollection chunks = Page.DecomposeViewStateIntoChunks();
                // Default chunk count is 1
                if (chunks.Count > 1) {
                    writer.Write(Page.ViewStateFieldCountID + "=" + chunks.Count + amp);
                }
                int count = 0;
                foreach (String state in chunks) {
                    writer.Write(Page.ViewStateFieldPrefixID);
                    if (count > 0) writer.Write(count.ToString(CultureInfo.CurrentCulture));
                    writer.Write("=" + HttpUtility.UrlEncode(state));
                    writer.Write(amp);
                    ++count;
                }

            }

            if (isCrossPagePostBack) {
                writer.Write(Page.previousPageID);
                writer.Write("=" + Page.EncryptString(Page.Request.CurrentExecutionFilePath, Purpose.WebForms_Page_PreviousPageID));
                writer.Write(amp);
            }

            writer.Write("__EVENTTARGET=" + HttpUtility.UrlEncode(target));
            writer.Write(amp);
            writer.Write("__EVENTARGUMENT=" + HttpUtility.UrlEncode(argument));
            // 

            string queryStringText = QueryString; 
            if (!String.IsNullOrEmpty(queryStringText)) {
                writer.Write(amp);
                writer.Write(queryStringText);
            }

            writer.Write("\"");
            if (!String.IsNullOrEmpty(accessKey)) {
                writer.WriteAttribute("accessKey", accessKey);
            }
            writer.Write(">");
            writer.Write(text);
            writer.WriteEndTag("a");
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:72,代码来源:PageAdapter.cs

示例8: RenderContents

		protected internal override void RenderContents (HtmlTextWriter writer)
		{
			bool selected = false;
			Page page = Page;
			for (int i = 0; i < Items.Count; i++) {
				ListItem item = Items [i];
				if (page != null)
					page.ClientScript.RegisterForEventValidation (UniqueID, item.Value);
				writer.WriteBeginTag ("option");
				if (item.Selected) {
					if (selected)
						VerifyMultiSelect ();
					writer.WriteAttribute ("selected", "selected", false);
					selected = true;
				}
				writer.WriteAttribute ("value", item.Value, true);

				if (item.HasAttributes)
					item.Attributes.Render (writer);

				writer.Write (">");
				string encoded = HttpUtility.HtmlEncode (item.Text);
				writer.Write (encoded);
				writer.WriteEndTag ("option");
				writer.WriteLine ();
			}
		}
开发者ID:tgiphil,项目名称:mono,代码行数:27,代码来源:ListControl.cs

示例9: RenderChildren

		override void RenderChildren (HtmlTextWriter w)
		{
			base.RenderChildren (w);

			if (items == null) {
				return;
			}
			
			w.WriteLine ();

			bool done_sel = false;
			
			int count = items.Count;
			for (int i = 0; i < count; i++) {
				ListItem item = items[i];
				w.Indent++;
				
				/* Write the <option> elements this
				 * way so that the output HTML matches
				 * the ms version (can't make
				 * HtmlTextWriterTag.Option an inline
				 * element, cos that breaks other
				 * stuff.)
				 */
				w.WriteBeginTag ("option");
				if (item.Selected && !done_sel) {

					w.WriteAttribute ("selected", "selected");

					if (!Multiple) {
						done_sel = true;
					}
				}
				
				w.WriteAttribute ("value", item.Value, true);
				w.Write (HtmlTextWriter.TagRightChar);
				
				w.Write (HttpUtility.HtmlEncode(item.Text));
				w.WriteEndTag ("option");
				w.WriteLine ();

				w.Indent--;
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:44,代码来源:HtmlSelect.cs

示例10: Render

 protected override void Render(HtmlTextWriter writer)
 {
     // Render control as a div with ID (to ensure IPostBackEventHandler works in UpdatePanel)
     writer.WriteBeginTag("div");
     writer.WriteAttribute("id", ClientID);
     writer.Write(HtmlTextWriter.TagRightChar);
     base.Render(writer);
     writer.WriteEndTag("div");
 }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:9,代码来源:CMSDeskTree.ascx.cs

示例11: Render

 protected internal override void Render(HtmlTextWriter writer) {
     writer.WriteBeginTag(TagName);
     RenderAttributes(writer);
     writer.Write(HtmlTextWriter.SelfClosingTagEnd);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:HtmlLink.cs

示例12: RenderContents

		protected override void RenderContents(HtmlTextWriter writer) {
			int		count;
			ListItem	item;
			bool		selected;

			if (writer == null) {
				return;
			}

			count = Items.Count;
			selected = false;

			for (int i = 0; i < count; i++) {
				item = Items[i];
				writer.WriteBeginTag("option");
				if (item.Selected) {
					if (selected) {
						throw new HttpException("DropDownList only may have a single selected item");
					}
					writer.WriteAttribute("selected", "selected", false);
					selected = true;
				}
				writer.WriteAttribute("value", item.Value, true);
				if (item.HasAttributes)
					item.Attributes.Render (writer);
				
				writer.Write(">");
				string text = HttpUtility.HtmlEncode (item.Text);
				writer.Write (text);
				writer.WriteEndTag("option");
				writer.WriteLine();
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:33,代码来源:DropDownList.cs

示例13: Render

 protected internal override void Render(HtmlTextWriter writer) {
     if (EnableLegacyRendering) {
         base.Render(writer);
     }
     else {
         // By default HTMLControl doesn't render a closing /> so its not XHTML compliance
         writer.WriteBeginTag(TagName);
         RenderAttributes(writer);
         writer.Write(HtmlTextWriter.SelfClosingTagEnd);
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:HtmlMeta.cs

示例14: RenderContents

 //[Match("match with ListBox RenderContents")]
 /// <summary>
 /// Renders the contents.
 /// </summary>
 /// <param name="w">The w.</param>
 protected override void RenderContents(HtmlTextWriter w)
 {
     var itemHash = Items;
     var itemCount = itemHash.Count;
     if (itemCount > 0)
     {
         var isA = false;
         for (int itemKey = 0; itemKey < itemCount; itemKey++)
         {
             var listItem = itemHash[itemKey];
             if (listItem.Enabled)
                 switch (listItem.Attributes["group"])
                 {
                     case "begin":
                         w.WriteBeginTag("optgroup");
                         w.WriteAttribute("label", listItem.Text);
                         w.Write('>');
                         break;
                     case "end":
                         w.WriteEndTag("optgroup");
                         break;
                     default:
                         w.WriteBeginTag("option");
                         if (listItem.Selected)
                         {
                             if (isA)
                                 VerifyMultiSelect();
                             isA = true;
                             w.WriteAttribute("selected", "selected");
                         }
                         w.WriteAttribute("value", listItem.Value, true);
                         if (listItem.Attributes.Count > 0)
                             listItem.Attributes.Render(w);
                         if (Page != null)
                             Page.ClientScript.RegisterForEventValidation(UniqueID, listItem.Value);
                         w.Write('>');
                         HttpUtility.HtmlEncode(listItem.Text, w);
                         w.WriteEndTag("option");
                         w.WriteLine();
                         break;
                 }
         }
     }
 }
开发者ID:BclEx,项目名称:BclEx-Web,代码行数:49,代码来源:DropDownListEx.cs

示例15: Render

    protected override void Render(HtmlTextWriter writer)
    {
        List<GroupedListItem> groupedListItems;

        writer.WriteBeginTag("select");
        writer.WriteAttribute("id", this.ClientID);
        writer.WriteAttribute("name", this.UniqueID);
        if (ChangeCausesPostback)
            writer.WriteAttribute("onchange", "document.forms[0].submit();");
        if (ClassName.Length > 0)
            writer.WriteAttribute("class", ClassName);
        writer.Write(HtmlTextWriter.TagRightChar);

        if (DataReady) {
            if (_grouplessItems != null && _grouplessItems.Count > 0)
                WriteOptions(writer, _grouplessItems);

            foreach (string groupName in _optionGroups.Keys) {
                writer.WriteBeginTag("optgroup");
                writer.WriteAttribute("label", groupName);
                writer.Write(HtmlTextWriter.TagRightChar);
                if (_optionGroups.TryGetValue(groupName, out groupedListItems)) {
                    WriteOptions(writer, groupedListItems);
                }
                writer.WriteEndTag("optgroup");
            }
        }

        writer.WriteEndTag("select");
    }
开发者ID:jaytem,项目名称:minGit,代码行数:30,代码来源:GroupedDropDownList.ascx.cs


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