2
我的web表單上有一個ASP.NET Calendar
控件。在日曆控件上自定義日期範圍的外觀
我已經定義的日期範圍與StartDate
和EndDate
,現在我需要做的所有天之間(包括StartDate
和EndDate
)紅色。
我該怎麼做?
我的web表單上有一個ASP.NET Calendar
控件。在日曆控件上自定義日期範圍的外觀
我已經定義的日期範圍與StartDate
和EndDate
,現在我需要做的所有天之間(包括StartDate
和EndDate
)紅色。
我該怎麼做?
您可以處理Calendar.DayRender
事件並自定義日期範圍內單元格的外觀。一個完整的例子是MSDN文檔頁面上,但最重要的部分是:
Sub DayRender(source As Object, e As DayRenderEventArgs)
' Change the background color of the days in the month to yellow.
If Not e.Day.IsOtherMonth And Not e.Day.IsWeekend Then
e.Cell.BackColor = System.Drawing.Color.Yellow
End If
End Sub 'DayRender
你只需要適應If
一天來比較您的自定義範圍,改變從黃色的背景顏色爲紅色。