Okay so I am a beginner with ASP.NET and I am trying to do a small project where I create a customer tracking website. I have done everything to be able to create my tables, add, edit, details and delete entries and I have gotten pretty much to the point where I am happy. My next step is to add sorting to my entries and to be able to add paging. I want to be able to make it on the website, that only 10 entries are displayed at a time. I have never done this before and googling and AI are just confusing me, as well as I have never used JSON before and adding that into my code broke everything and I wasn't sure how to fix it/
This is my code for my Index.cshtml: that gives me the display of each entry as well as the edit, details and delete buttons. I'm not sure if the paging and sorting will even go into this view code or if I have to create another model/controller and if it does go in here, I am not sure where.
@model IEnumerable<ArksoftTestDev.Models.Customer>
@{
ViewBag.Title = "Index";
}
<body style="background-color: #002f3c ">
<h1 style="color: #b5ff1e; ">Index</h1>
<h4 >
@Html.ActionLink("Create New", "Create")
</h4>
<table class="table" >
<tr>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.Name)
</th>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.Address)
</th>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.TelephoneNumber)
</th>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.ContactPersonName)
</th>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.ContactPersonEmail)
</th>
<th style="color: forestgreen; ">
@Html.DisplayNameFor(model => model.VATNumber)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.Name)
</td>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.Address)
</td>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.TelephoneNumber)
</td>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.ContactPersonName)
</td>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.ContactPersonEmail)
</td>
<td style="color: whitesmoke; ">
@Html.DisplayFor(modelItem => item.VATNumber)
</td>
<td style="color: whitesmoke; ">
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })
</td>
</tr>
}
</table>
</body>
I have tried using JQueries and LINQ, but tutorials were not helping and I am now very confused and frustrated that I cannot get this to work. Please can someone explain and help me in a "explaining for dummies" sort of way!