[Mono-dev] WebControl DataList SelectedIndex and EditItemIndex patch

Jarosław Pawlak jarek.pawlak at gmail.com
Thu Jun 22 07:39:17 EDT 2006


Hello

On DataList control, when edited item happens to be also selected
item, there was a problem, because DataList generated item from
SelectedItem template instead of EditItemTemplate.
This patch fixes the problem.

Jarek
=======================================================================================================
--- DataList.cs.orig    (rev 1.1.15)
+++ DataList.cs (my)
@@ -632,10 +632,10 @@
                       case ListItemType.SelectedItem:
                       case ListItemType.EditItem:
                               int index = item.ItemIndex;
-                               if ((SelectedIndex == index) &&
(SelectedItemTemplate != null))
-                                       t = SelectedItemTemplate;
-                               else if ((EditItemIndex == index) &&
(EditItemTemplate != null))
+                               if ((EditItemIndex == index) &&
(EditItemTemplate != null))
                                       t = EditItemTemplate;
+                               else if ((SelectedIndex == index) &&
(SelectedItemTemplate != null))
+                                       t = SelectedItemTemplate;
                               else if (((index & 1) == 0) ||
(alternatingItemTemplate == null))
                                       t = ItemTemplate;
                               else

=======================================================================================================



More information about the Mono-devel-list mailing list