Results 1 to 12 of 12

Thread: [RESOLVED] Decrement displaying of data

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Posts
    133

    Resolved [RESOLVED] Decrement displaying of data

    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 })?
    Last edited by azsx123; May 20th, 2011 at 12:19 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width