モデル クラス オブジェクトを含む arraylist があります。配列リストを作成する方法は次のとおりです。
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
この arraylist を使用して、ビュー ページにレコードのテーブルを生成したいと考えています。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%>