本文整理汇总了C#中System.Web.UI.WebControls.TableRow.ApplyStyle方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.ApplyStyle方法的具体用法?C# TableRow.ApplyStyle怎么用?C# TableRow.ApplyStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TableRow
的用法示例。
在下文中一共展示了TableRow.ApplyStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayItem
public virtual void DisplayItem(Table table, IConfigurationElement element, string index, IBinder binder, ITemplatingItem item, TableItemStyle style, TableItemStyle invalidStyle, Dictionary<string, Control> registry, WebPartManager manager)
{
string[] span = null;
if (element.Attributes.ContainsKey("span") && null != element.GetAttributeReference("span").Value)
span = element.GetAttributeReference("span").Value.ToString().Split(new char[] { ',' });
string[] rowspan = null;
if (element.Attributes.ContainsKey("rowspan") && null != element.GetAttributeReference("rowspan").Value)
rowspan = element.GetAttributeReference("rowspan").Value.ToString().Split(new char[] { ',' });
TableRow tr = new TableRow();
tr.ID = string.Concat(new string[]
{
table.ID,
"-",
element.ConfigKey,
"-",
index
});
tr.Attributes["key"] = element.ConfigKey;
tr.ApplyStyle(style);
foreach (IConfigurationElementAttribute attribute in element.Attributes.Values)
{
if ("span" != attribute.ConfigKey && "rowspan" != attribute.ConfigKey)
{
tr.Style.Add(attribute.ConfigKey, attribute.Value.ToString());
}
}
table.Rows.Add(tr);
int count = 0;
foreach (IConfigurationElement controlElement in element.Elements.Values)
{
TableCell tc = new TableCell();
tc.ID = tr.ID + "-" + controlElement.ConfigKey;
tc.Attributes["key"] = controlElement.ConfigKey;
if (span != null && span.Length > count)
{
int columnSpan = 1;
int.TryParse(span[count], out columnSpan);
tc.ColumnSpan = columnSpan;
if (rowspan != null && rowspan.Length > count)
{
int rowSpan = 1;
int.TryParse(rowspan[count], out rowSpan);
tc.RowSpan = rowSpan;
}
count++;
}
tr.Cells.Add(tc);
string pullpush = null;
foreach (IConfigurationElement propertyElement in controlElement.Elements.Values)
{
if (propertyElement.Attributes.ContainsKey("for") && "cell" == propertyElement.GetAttributeReference("for").Value.ToString() && propertyElement.Attributes.ContainsKey("member") && propertyElement.Attributes.ContainsKey("value"))
{
try
{
ReflectionServices.SetValue(tc, propertyElement.GetAttributeReference("member").Value.ToString(), propertyElement.GetAttributeReference("value").Value);
}
catch (Exception ex)
{
ControlFactory.Instance.Monitor.Register(ControlFactory.Instance, ControlFactory.Instance.Monitor.NewEventInstance("set cell attributes error", null, ex, EVENT_TYPE.Error));
}
}
if (propertyElement.Attributes.ContainsKey("pull"))
{
pullpush = propertyElement.GetAttributeReference("pull").Value.ToString();
}
else
{
if (propertyElement.Attributes.ContainsKey("push"))
{
pullpush = propertyElement.GetAttributeReference("push").Value.ToString();
}
}
}
Control cellControl = ControlFactory.Instance.CreateControl(controlElement, index, binder, item, tc, invalidStyle, registry, manager);
if (null != cellControl)
{
cellControl.ID = string.Concat(new string[]
{
table.ID,
"-",
element.ConfigKey,
"-",
index,
"-",
controlElement.ConfigKey,
"-ctrl"
});
tc.Controls.Add(cellControl);
if (cellControl is BaseDataBoundControl && !string.IsNullOrEmpty(pullpush))
{
if (!item.BoundControls.ContainsKey(pullpush))
{
item.BoundControls.Add(pullpush, new List<BaseDataBoundControl>());
}
item.BoundControls[pullpush].Add((BaseDataBoundControl)cellControl);
}
}
//.........这里部分代码省略.........