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


C# HtmlTextWriter.WriteAttribute方法代码示例

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


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

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

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

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

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

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

示例6: PreProcessRelativeReference

		internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
			string attr = Attributes[attribName];
			if (attr != null){
				if (attr.Length != 0){
					try{
						attr = ResolveClientUrl(attr);
					}
					catch (Exception) {
						throw new HttpException(attribName + " property had malformed url");
					}
					writer.WriteAttribute(attribName, attr);
					Attributes.Remove(attribName);
				}
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:15,代码来源:HtmlControl.cs

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

示例8: RenderAttributes

		protected override void RenderAttributes (HtmlTextWriter w)
		{
			/* Need to always render: method, action and id
			 */
			/* The name attribute is rendered _only_ if we're not in
			   2.0 mode or if the xhtml conformance mode is set to
			   Legacy for 2.0 according to http://msdn2.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlform.name.aspx
			*/
			
			string action;
			string customAction = Attributes ["action"];
			Page page = Page;
			HttpRequest req = page != null ? page.Request : null;
			if (req == null)
				throw new HttpException ("No current request, cannot continue rendering.");
#if !TARGET_J2EE
			if (String.IsNullOrEmpty (customAction)) {
				string file_path = req.ClientFilePath;
				string current_path = req.CurrentExecutionFilePath;
				if (file_path == current_path) {
					// Just the filename will do
					action = UrlUtils.GetFile (file_path);
				} else {
					// Fun. We need to make cookieless sessions work, so no
					// absolute paths here.
					bool cookieless;
					SessionStateSection sec = WebConfigurationManager.GetSection ("system.web/sessionState") as SessionStateSection;
					cookieless = sec != null ? sec.Cookieless == HttpCookieMode.UseUri: false;
					string appVPath = HttpRuntime.AppDomainAppVirtualPath;
					int appVPathLen = appVPath.Length;
						
					if (appVPathLen > 1) {
						if (cookieless) {
							if (StrUtils.StartsWith (file_path, appVPath, true))
								file_path = file_path.Substring (appVPathLen);
						} else if (StrUtils.StartsWith (current_path, appVPath, true))
							current_path = current_path.Substring (appVPathLen);
					}
					
					if (cookieless) {
						Uri current_uri = new Uri ("http://host" + current_path);
						Uri fp_uri = new Uri ("http://host" + file_path);
						action = fp_uri.MakeRelative (current_uri);
					} else
						action = current_path;
				}
			} else
				action = customAction;
			action += req.QueryStringRaw;
#else
			// Allow the page to transform action to a portlet action url
			if (String.IsNullOrEmpty (customAction)) {
				string queryString = req.QueryStringRaw;
				action = CreateActionUrl (VirtualPathUtility.ToAppRelative (req.CurrentExecutionFilePath) +
					(string.IsNullOrEmpty (queryString) ? string.Empty : "?" + queryString));
			}
			else
				action = customAction;

#endif

			XhtmlConformanceSection xhtml = WebConfigurationManager.GetSection ("system.web/xhtmlConformance") as
				XhtmlConformanceSection;
			
			if (xhtml != null && xhtml.Mode == XhtmlConformanceMode.Legacy)
				w.WriteAttribute ("name", Name);

			w.WriteAttribute ("method", Method);
			if (String.IsNullOrEmpty (customAction))
				w.WriteAttribute ("action", action, true);

			/*
			 * This is a hack that guarantees the ID is set properly for HtmlControl to
			 * render it later on. As ugly as it is, we use it here because of the way
			 * the ID, ClientID and UniqueID properties work internally in our Control
			 * code.
			 *
			 * Fixes bug #82596
			 */
			if (ID == null) {
#pragma warning disable 219
				string client = ClientID;
#pragma warning restore 219
			}
			
			string submit = page != null ? page.GetSubmitStatements () : null;
			if (!String.IsNullOrEmpty (submit)) {
				Attributes.Remove ("onsubmit");
				w.WriteAttribute ("onsubmit", submit);
			}
			
			/* enctype and target should not be written if
			 * they are empty
			 */
			string enctype = Enctype;
			if (!String.IsNullOrEmpty (enctype))
				w.WriteAttribute ("enctype", enctype);

			string target = Target;
			if (!String.IsNullOrEmpty (target))
//.........这里部分代码省略.........
开发者ID:kumpera,项目名称:mono,代码行数:101,代码来源:HtmlForm.cs

示例9: RenderAttributes

		protected override void RenderAttributes (HtmlTextWriter writer)
		{
			Page page = Page;
			if (page != null)
				page.ClientScript.RegisterForEventValidation (this.UniqueID, Value);
			writer.WriteAttribute ("value", Value, true);
			Attributes.Remove ("value");
			base.RenderAttributes (writer);
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:HtmlInputRadioButton.cs

示例10: RenderAttributes

		protected override void RenderAttributes (HtmlTextWriter writer)
		{
			Page page = Page;
			if (page != null && Events [ServerClickEvent] != null) {
				PostBackOptions options = GetPostBackOptions ();
				Attributes ["onclick"] += page.ClientScript.GetPostBackEventReference (options, true);
				writer.WriteAttribute ("language", "javascript");
			}

			base.RenderAttributes (writer);
		}
开发者ID:nobled,项目名称:mono,代码行数:11,代码来源:HtmlButton.cs

示例11: RenderAttributes

		protected override void RenderAttributes (HtmlTextWriter writer)
		{
#if NET_2_0
			if (Page != null)
				Page.ClientScript.RegisterForEventValidation (UniqueID);
			
			if (CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup)) {
				ClientScriptManager csm = Page.ClientScript;
				Attributes ["onclick"] += csm.GetClientValidationEvent (ValidationGroup);
			}
#else		
			if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (Page);
				writer.WriteAttribute ("onclick", csm.GetClientValidationEvent ());
			}
#endif		

			PreProcessRelativeReference (writer,"src");
			base.RenderAttributes (writer);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:20,代码来源:HtmlInputImage.cs

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

示例13: WriteOptions

    private void WriteOptions(HtmlTextWriter writer, List<GroupedListItem> groupedListItems)
    {
        foreach (GroupedListItem gli in groupedListItems) {
            writer.WriteBeginTag("option");
            writer.WriteAttribute("value", GetReferenceKey(gli)); // writer.WriteAttribute("value", gli.Value);
            if (!gli.Enabled)
                writer.WriteAttribute("disabled", "disabled");

            if (gli.Selected)
                writer.WriteAttribute("selected", "selected");
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.Write(gli.Text);
            writer.WriteEndTag("option");
        }
    }
开发者ID:jaytem,项目名称:minGit,代码行数:15,代码来源:GroupedDropDownList.ascx.cs

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

示例15: RenderAttributes

		protected override void RenderAttributes (HtmlTextWriter w)
		{
#if NET_2_0
			if (Page != null)
				Page.ClientScript.RegisterForEventValidation (UniqueID);
#endif
			/* If there is no "name" attribute,
			 * LoadPostData doesn't work...
			 */
			w.WriteAttribute ("name", Name);
			Attributes.Remove ("name");
			
			/* Don't render the databinding attributes */
			Attributes.Remove ("datamember");
			Attributes.Remove ("datatextfield");
			Attributes.Remove ("datavaluefield");
			
			base.RenderAttributes (w);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:19,代码来源:HtmlSelect.cs


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