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


C# WebControl.ResolveClientUrl方法代码示例

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


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

示例1: AddAttributesToRender

		public override void AddAttributesToRender (HtmlTextWriter writer, WebControl owner)
		{
			base.AddAttributesToRender (writer, owner);
			if (writer == null)
				return;

			// note: avoid calling properties multiple times
			int i = CellSpacing;
			if (i != -1) {
				writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (Helpers.InvariantCulture), false);
				if (i == 0)
					writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
			}

			i = CellPadding;
			if (i != -1)
				writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (Helpers.InvariantCulture), false);
			
			GridLines g = GridLines;
			switch (g) {
			case GridLines.Horizontal:
				writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows", false);
				break;
			case GridLines.Vertical:
				writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols", false);
				break;
			case GridLines.Both:
				writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all", false);
				break;
			}

			// note: avoid ToString on the enum
			switch (HorizontalAlign) {
			case HorizontalAlign.Left:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
				break;
			case HorizontalAlign.Center:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "center", false);
				break;
			case HorizontalAlign.Right:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
				break;
			case HorizontalAlign.Justify:
				writer.AddAttribute (HtmlTextWriterAttribute.Align, "justify", false);
				break;
			}
#if NET_4_0
			if (g != GridLines.None && BorderWidth.IsEmpty)
				writer.AddAttribute (HtmlTextWriterAttribute.Border, "1", false);
#else
			// border (=0) is always present (and base class doesn't seems to add it)
			// but border is "promoted" to 1 if gridlines are present (with BorderWidth == 0)
			if (g == GridLines.None) {
				writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
			} else if (BorderWidth.IsEmpty) {
				writer.AddAttribute (HtmlTextWriterAttribute.Border, "1", false);
			} else {
				writer.AddAttribute (HtmlTextWriterAttribute.Border, BorderWidth.Value.ToString (Helpers.InvariantCulture));
			}
#endif
#if !NET_2_0
			string s = BackImageUrl;
			if (s.Length > 0) {
				if (owner != null)
					s = owner.ResolveClientUrl (s);
				s = String.Concat ("url(", s, ")");
				writer.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, s);
			}
#endif
		}
开发者ID:nobled,项目名称:mono,代码行数:70,代码来源:TableStyle.cs


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