Author: gonzalo
Date: 2006-09-24 14:21:08 -0400 (Sun, 24 Sep 2006)
New Revision: 65868
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
Log:
2006-09-24 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* DataList.cs: use ExtractTemplateRows to determine if the style is
applied to the Table in a template or to its rows. Fixes bug #78058.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-09-24 17:41:15 UTC (rev 65867)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-09-24 18:21:08 UTC (rev 65868)
@@ -1,3 +1,8 @@
+2006-09-24 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+ * DataList.cs: use ExtractTemplateRows to determine if the style is
+ applied to the Table in a template or to its rows. Fixes bug #78058.
+
2006-09-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* ListBox.cs: if the list is not enabled, don't require a postback.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
2006-09-24 17:41:15 UTC (rev 65867)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
2006-09-24 18:21:08 UTC (rev 65868)
@@ -756,7 +756,7 @@
updateCommand (this, e);
}
- void ApplyControlStyle (Control ctrl, Style style)
+ void ApplyControlStyle (Control ctrl, Style style, bool
apply_to_rows)
{
if (style == null || false == ctrl.HasControls ())
return;
@@ -764,8 +764,12 @@
foreach (Control c in ctrl.Controls) {
if (c is Table) {
Table tbl = (Table) c;
- foreach (TableRow row in tbl.Rows)
- row.MergeStyle (style);
+ if (apply_to_rows) {
+ foreach (TableRow row in
tbl.Rows)
+ row.MergeStyle (style);
+ } else {
+ tbl.MergeStyle (style);
+ }
}
}
}
@@ -776,11 +780,12 @@
return; // No one called
CreateControlHierarchy() with DataSource != null
Style alt = null;
+ bool apply_to_rows = ExtractTemplateRows;
foreach (DataListItem item in Controls) {
switch (item.ItemType) {
case ListItemType.Item:
item.MergeStyle (itemStyle);
- ApplyControlStyle (item, itemStyle);
+ ApplyControlStyle (item, itemStyle,
apply_to_rows);
break;
case ListItemType.AlternatingItem:
if (alt == null) {
@@ -793,16 +798,21 @@
}
}
+ if (itemStyle != null)
+ Console.WriteLine
("itemStyle.BackColor: {0}", itemStyle.BackColor);
+ if (alternatingItemStyle != null)
+ Console.WriteLine
("alternatingItemStyle.BackColor: {0}", alternatingItemStyle.BackColor);
+ Console.WriteLine ("alt.BackColor:
{0}", alt.BackColor);
item.MergeStyle (alt);
- ApplyControlStyle (item, alt);
+ ApplyControlStyle (item, alt,
apply_to_rows);
break;
case ListItemType.EditItem:
if (editItemStyle != null) {
item.MergeStyle (editItemStyle);
- ApplyControlStyle (item,
editItemStyle);
+ ApplyControlStyle (item,
editItemStyle, apply_to_rows);
} else {
item.MergeStyle (itemStyle);
- ApplyControlStyle (item,
itemStyle);
+ ApplyControlStyle (item,
itemStyle, apply_to_rows);
}
break;
case ListItemType.Footer:
@@ -812,7 +822,7 @@
}
if (footerStyle != null) {
item.MergeStyle (footerStyle);
- ApplyControlStyle (item,
footerStyle);
+ ApplyControlStyle (item,
footerStyle, apply_to_rows);
}
break;
case ListItemType.Header:
@@ -822,26 +832,26 @@
}
if (headerStyle != null) {
item.MergeStyle (headerStyle);
- ApplyControlStyle (item,
headerStyle);
+ ApplyControlStyle (item,
headerStyle, apply_to_rows);
}
break;
case ListItemType.SelectedItem:
if (selectedItemStyle != null) {
item.MergeStyle
(selectedItemStyle);
- ApplyControlStyle (item,
selectedItemStyle);
+ ApplyControlStyle (item,
selectedItemStyle, apply_to_rows);
} else {
item.MergeStyle (itemStyle);
- ApplyControlStyle (item,
itemStyle);
+ ApplyControlStyle (item,
itemStyle, apply_to_rows);
}
break;
case ListItemType.Separator:
if (separatorStyle != null) {
item.MergeStyle(separatorStyle);
- ApplyControlStyle (item,
separatorStyle);
+ ApplyControlStyle (item,
separatorStyle, apply_to_rows);
}
else {
item.MergeStyle (itemStyle);
- ApplyControlStyle (item,
itemStyle);
+ ApplyControlStyle (item,
itemStyle, apply_to_rows);
}
break;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches