public async Task<IActionResult> Index()
{
// return View(await _context.AnalSubTasks.ToListAsync());
var getanalsub = (IEnumerable<AnalSubTask>)_context.AnalSubTasks.FromSqlRaw("spGetanalsub null").ToList();
return View(getanalsub);
}
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Ident)
</td>
<td>
@Html.DisplayFor(modelItem => item.date_created)
</td>
But if I use a multitable I can't figure out the syntax.@model OASIS_MVC.View.ViewModel.mainviewmodelV
<tbody>
@foreach (var item in Model.SubTasks)
{
<tr>
<td>
@Html.DisplayFor(modelItem => Model.SubTasks.Ident)
</td>
<td>
@Html.DisplayFor(modelItem => Model.SubTasks.date_created)
</td>
public IActionResult Edit(int? id)
{
var tables = new mainviewmodelV
{
getanalmainV = (IEnumerable<Mainview>)_db3.mainviewmodelV.FromSqlRaw("spGetanalmain {0},{1}", null,id).ToList(),
SubTasks = (IEnumerable<AnalSubTask>)_db3.AnalSubTasks.FromSqlRaw("spGetanalsub null").ToList()
};
return View(tables);
}
<label asp-for="getanalmainV.FirstOrDefault().Envelope" class="control-label col-xl-1 h-100 flex-fixed-width-item text-right bg-info"></label>
<input asp-for="getanalmainV.FirstOrDefault().Envelope" class="form-control col-xl-1 h-100 flex-fixed-width-item" />
<span asp-validation-for="getanalmainV.FirstOrDefault().Envelope" class="text-danger"></span>
The second table is just a list of non editable data for reference.ASKER
ASKER
@foreach (var item in Model.SubTasks)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Ident)
</td>
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications
TRUSTED BY
Do you want Master-Detailed kind of multiple tables or two separate tables to be printed separately?