0
我有一個簡單的asp.net日曆,它突出顯示並輸入用戶名稱,在他們請求假期的日子裏。但是,最新的請求將覆蓋舊請求的名稱而不是顯示多個名稱。代碼如下:ASP.net日曆DayRender每天顯示多個文本響應
Protected Sub Calendar1_DayRender(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) _
Handles Calendar1.DayRender
Dim nextDate As DateTime
Dim StartDate As DateTime
Dim Enddate As DateTime
Dim username As String
If Not dsHolidays Is Nothing Then
For Each dr As DataRow In dsHolidays.Tables(0).Rows
StartDate = CType(dr("StartDate"), DateTime)
Enddate = CType(dr("EndDate"), DateTime)
nextDate = CType(dr("startdate"), DateTime)
username = CType(dr("username"), String)
If e.Day.Date >= StartDate And e.Day.Date <= Enddate Then
e.Cell.Text = username
e.Cell.BackColor = System.Drawing.Color.Pink
End If
Next
End If
End Sub
有什麼建議嗎?
謝謝... e.Cell.Text + =用戶名工作正常...無論如何,我可以讓他們顯示在單獨的行/段?它目前直接顯示一個 – user1055487 2012-02-23 16:31:38
耶 - 只要將其更改爲e.Cell.Text + =用戶名+「
」,或者您希望它顯示。如果你想要看起來,你可以添加一個新的表格控件到單元格中,並將每個用戶名作爲單元格添加到該表格中。 – jmaglio 2012-02-23 16:49:19