I want to make a "announcements" page and what I want to happen is that when a user posts a news, the post will be saved into the database and is defined by a unique ID (using autonumber). So data is arranged by that.
When a user loads the page, announcements will be displayed from lastest to oldest.
So what I'm trying to ask here is how can I list data from latest to oldest.
The container of the announcements is below
Code:<table > <tr> <th> Date Posted </th> <th> Author </th> <th> Title </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.NewsDate) </td> <td> @Html.DisplayFor(modelItem => item.Author) </td> <td> @Html.DisplayFor(modelItem => item.NewsTitle) </td> <td> @Html.ActionLink("Read", "Details", new { id=item.ID }) </td> </tr> }
Edit: Is there a way that " @Html.DisplayFor(modelItem => item.NewsTitle)" will funtion as a link similar to @Html.ActionLink("Read", "Details", new { id=item.ID })?




Reply With Quote