Hi,

The attached patch fixes bug 
http://bugzilla.ximian.com/show_bug.cgi?id=78603

Is it okay to commit?

- Juraj
Index: System.Web.UI.WebControls/ChangeLog
===================================================================
--- System.Web.UI.WebControls/ChangeLog	(revision 61599)
+++ System.Web.UI.WebControls/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2006-06-13 Juraj Skripsky <[EMAIL PROTECTED]>
+
+	* Calendar.cs: Make sure WebControls.Enabled is respected.
+	* SelectedDatesCollection.cs: Set time for all DateTime object passed in to
+	12:00am as MS.NET does the same.
+	Fixes bug #71251.
+
 2006-05-24  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
 	* DataList.cs: Fixed LoadViewState method
Index: System.Web.UI.WebControls/Calendar.cs
===================================================================
--- System.Web.UI.WebControls/Calendar.cs	(revision 61599)
+++ System.Web.UI.WebControls/Calendar.cs	(working copy)
@@ -924,7 +924,7 @@
 					int days =  DateTime.DaysInMonth (DisplayDate.Year, DisplayDate.Month);
 
 					selector.RenderBeginTag (writer);
-					writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + days, SelectMonthText, DayHeaderStyle.ForeColor, true));
+					writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + days, SelectMonthText, DayHeaderStyle.ForeColor, Enabled));
 					selector.RenderEndTag (writer);
 				}
 			}
@@ -1015,7 +1015,7 @@
 				style.CopyFrom (otherMonthDayStyle);
 			}
 
-			if (day.IsSelected) {
+			if (day.IsSelected && Enabled) {
 				style.BackColor = Color.Silver;
 				style.ForeColor = Color.White;
 				if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) {
@@ -1026,7 +1026,7 @@
 			cell.ApplyStyle (style);
 
 			lit.Text = BuildLink (GetDaysFromZenith (date).ToString (), day.DayNumberText,
-					      cell.ForeColor, day.IsSelectable);
+					      cell.ForeColor, day.IsSelectable && Enabled);
 
 			cell.RenderControl (writer);
 		}
@@ -1063,7 +1063,7 @@
 					}
 
 					selectorCell.RenderBeginTag (writer);
-					writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + "07", SelectWeekText, selectorCell.ForeColor, true));
+					writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + "07", SelectWeekText, selectorCell.ForeColor, Enabled));
 					selectorCell.RenderEndTag (writer);
 				}
 
@@ -1163,7 +1163,7 @@
 				DateTime date = GetGlobalCalendar().AddMonths (DisplayDate, - 1);
 				date = GetGlobalCalendar().AddDays (date, -DisplayDate.Day + 1);
 				cellNextPrev.RenderBeginTag (writer);
-				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, false), cellNextPrev.ForeColor, true));
+				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, false), cellNextPrev.ForeColor, Enabled));
 				cellNextPrev.RenderEndTag (writer);
 			}
 
@@ -1191,7 +1191,7 @@
 
 				cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
 				cellNextPrev.RenderBeginTag (writer);
-				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, true), cellNextPrev.ForeColor, true));
+				writer.Write (BuildLink ("V" + GetDaysFromZenith (date), GetNextPrevFormatText (date, true), cellNextPrev.ForeColor, Enabled));
 				cellNextPrev.RenderEndTag (writer);
 			}
 
Index: System.Web.UI.WebControls/SelectedDatesCollection.cs
===================================================================
--- System.Web.UI.WebControls/SelectedDatesCollection.cs	(revision 61599)
+++ System.Web.UI.WebControls/SelectedDatesCollection.cs	(working copy)
@@ -45,7 +45,8 @@
 	
 		public void Add (DateTime date)
 		{
-			if (Contains (date) == false)
+			date = date.Date;
+			if (!l.Contains (date))
 				l.Add (date);
 		}
 		
@@ -56,7 +57,7 @@
 		
 		public bool Contains (DateTime date)
 		{
-			return l.Contains (date);
+			return l.Contains (date.Date);
 		}
 		
 		public void CopyTo (Array array, int index)
@@ -71,11 +72,14 @@
 		
 		public void Remove (DateTime date)
 		{
-			l.Remove (date);
+			l.Remove (date.Date);
 		}
 		
 		public void SelectRange (DateTime fromDate, DateTime toDate)
 		{
+			fromDate = fromDate.Date;
+			toDate = toDate.Date;
+			
 			l.Clear ();
 			for (DateTime dt = fromDate; dt <= toDate; dt = dt.AddDays (1))
 				Add (dt);
_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to