I made Index view by ADO.NET(model), MVC 5 controller use Entity Framework with views(controller).
It is so easy way. but I got a problem when I try make two table (in a view).
How can I show two tables in one view.
I wanna reference multiple models. But I can refer just one model as below
(in view)
@ModelType IEnumerable(Of Ora_Connect.UsersData)
please advise
This is made by Visual Basic
added comment
Hello again. could you advice for me. I transf from C# to VB. So, I made masterview for multi table. I tried about 3days. but not solved yet thank you so much.
model
Public Class TestMulti_ViewModel
Public Property Test1 As IEnumerable(Of SCT_AUTH_OUT)
Public Property Test2 As IEnumerable(Of SCT_AUTH_OUT_ADD)
control
Namespace Controllers
Public Class TestMultiController
Inherits Controller
'Private db1 As New TestMulti_Entities1
' GET: TestMulti
Function Index_Test(ByVal searchString As String) As ActionResult
Dim mview = New TestMulti_ViewModel
Return View(mview.Test1.ToList())
End Function
End Class
@Modeltype IEnumerable(Of TestMulti_ViewModel)
View
@Modeltype IEnumerable(Of TestMulti_ViewModel)
<table class="table">
@Code Dim item As SCT_AUTH_OUT End Code
<tr>
<th>
@Html.DisplayNameFor(Function(model As SCT_AUTH_OUT) model.ID)
</th>
<th>
@Html.DisplayNameFor(Function(model As SCT_AUTH_OUT) model.PASS)
</th>
<th>
@Html.DisplayNameFor(Function(model As SCT_AUTH_OUT) model.NAMEK)
</th>
<th></th>
</tr>
@code Dim mview = New TestMulti_ViewModel().Test1 end code
@For Each item In mview
@<tr>
<td>
@Html.DisplayFor(Function(model As SCT_AUTH_OUT) item.ID)
</td>
<td>
@Html.DisplayFor(Function(model As SCT_AUTH_OUT) item.PASS)
</td>
<td>
@Html.DisplayFor(Function(modelItem As SCT_AUTH_OUT) item.NAMEK)
</td>
<td>
</td>
</tr>
Next
</table>