Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8989079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:09:57+00:00 2026-06-15T22:09:57+00:00

I have had look at a few post already here but I am none

  • 0

I have had look at a few post already here but I am none the wiser. I tried my first example of Ajax but to no avail. The Partial View is loaded into a separate page as opposed to changing the dom element in the current page.

The pupose is by clicking on the Refresh link in updates the “Last Activity Date” value of the current row only.

Please if there is an easy well of doing this can you also let me know?

View:

@model IEnumerable<RegistrationManager.User>

@{
    ViewBag.Title = "Users";
}

@section scripts {
    @Content.Script(Url, "jquery-unobtrusive-ajax.min.js")
}
<h2>Users</h2>


<table>
    <tr>
        <th>Email Address</th>
        <th>Given Names</th>
        <th>Surname</th>
        <th>Last Activity Date</th>
        <th>Refresh</th>
    </tr>

@foreach (var item in Model)
{
    string selectedRow = "";
    if (ViewBag.UserId != null && item.UserId == ViewBag.UserId)  
    {  
        selectedRow = "selectedrow";  
    }  
    <tr class="@selectedRow" valign="top">
       <td>
            @item.UserName
        </td>
        <td>
            @item.Profile.GivenNames
        </td>
        <td>
            @item.Profile.Surname
        </td>
        <td>
            <div id="@String.Format("LastActivityDate{0}", item.UserId)">@Html.Partial("_DateOnlyPartialView", item.LastActivityDate)</div>
        </td>
        <td>
            @Ajax.ActionLink("Refresh", "Refresh",
                         new { UserId = item.UserId },
                         new AjaxOptions {
                             UpdateTargetId = "LastActivityDate" + item.UserId,
                             InsertionMode = InsertionMode.Replace,
                             HttpMethod = "GET"                                 
                        })
        </td>
    </tr>
}

</table>

Conrtoller:

public PartialViewResult Refresh(Guid? UserId)
{
    User user = _db.Users.Find(UserId);
    user.RefreshLastActivityDate();
    return PartialView("_DateOnlyPartialView", user.LastActivityDate);
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:09:58+00:00Added an answer on June 15, 2026 at 10:09 pm

    Have you included/referenced all the necessary javascript files?

    If you have UnobtrusiveJavaScriptEnabled then you’ll need:

    1. jQuery
    2. jquery.unobtrusive-ajax.js

    if you also use client side validation, you’ll need;

    1. jquery.validate.js
    2. jquery.validate.unobtrusive.js

    These files can all be found when you create a new MVC3 project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies if this was already asked but, I have had a look and can't
I have had a look all over, but it doesn't seem as though my
I have had a fairly thorough look around, but couldn't find anything related, so
I've had a look around and I have found a few questions like mine
I had a look at a few possible duplicates for this question but rewrite
I've had a look at a few threads but what I'm aiming for I
I am a long time C# developer and have had to look at some
I have had this problem crop up a few times and I can't figure
I have had Delphi 2007 for a while. I tried the Delphi 2009 trial.
I have had a few problems getting this right, so I wanted to ask

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.