我有一个数组列表,其中包含模型类对象。这是我创建数组列表的方法。
Dim arr As New ArrayList
Dim citizenHelper As New CitizensHelper
While dr.Read
Dim appointment As New Appointment
appointment.AppointmentId = dr("appointment_id")
appointment.DoctorNin = dr("doctor_nin")
appointment.DoctorName = citizenHelper.getNameByNin(dr("doctor_nin"))
appointment.PatientNin = dr("patient_nin")
appointment.PatientName = citizenHelper.getNameByNin(dr("patient_nin"))
appointment.BookingDate = dr("booking_date")
If dr("cancelled") Is "1" Then
appointment.Cancelled = True
End If
If dr("active") Is "1" Then
appointment.Active = True
End If
arr.Add(appointment) 'I add to the array like this
End While
ViewData("row") = arr
我想使用这个数组列表在视图页面上生成一个记录表。我尝试使用 for 循环,但我无法访问这样的模型值。所以请告诉我,我该如何解决这个问题?
我试着做这样的事情
<% For Each ap As ArrayList In ViewData("row")%>
<tr>
<td>
...... <!-- Now I want to show those value from a table here -->
</td>
</tr>
<% Next ap%>