本文整理汇总了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
}