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 6689585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:32:12+00:00 2026-05-26T05:32:12+00:00

I have a Controller listed below: // // GET: /Customer/Details/5 public ActionResult Details(short id)

  • 0

I have a Controller listed below:

//
// GET: /Customer/Details/5
public ActionResult Details(short id)
{
    ActionResult actionResult = null;

    if (HttpContext.User.IsInRole("Admin"))
    {
        // this is the logic that is getting executed
        YeagerTechWcfService.Customer cust = db.GetCustomerID(Convert.ToInt16(id));
        actionResult = View("Details", cust);           }
    else
    {
        HttpCookie cn = Request.Cookies["strCookieName"];
        if (cn != null)
        {
            YeagerTechWcfService.Customer cust = db.GetCustomerID(Convert.ToInt16(id));
            actionResult = View("Details", cust);
        }
        else
        {
            TempData["ErrCode"] = "CustView";
            actionResult = RedirectToAction("Index", "Home");
        }
    }

    return actionResult;
}

I have a View (where the ActionLink is) like below:

columns.Template(
    @<text>
    @Ajax.ActionLink("Detail", "Details", "Customer", new { id = item.CustomerID },
    new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "detailCustomer" })
    </text>
).Width(70); 

The rendered output is now as follows:

<a data-ajax="true" data-ajax-mode="replace" data-ajax-update="#detailCustomer" href="/Customer/Details/2">Detail</a> 

If I click on the link from within the source view of the browser, I get to my new View just fine.

However, if I try and click on the ActionLink, the View doesn’t come up. I can verify during debugging, that I’m stepping thru the Details View after I hit that controller code. The present view just stays in place without switching to the new View.

Moreover, I can see that if I click on the ActionLink, it executes the same exact code (during debugging) as when I paste it into the address bar:

http://localhost:4514/Customer/Details/2

When I click on the ActionLink, even though the same code is executed, the address url doesn’t change to the above. and the View is not being rendered.

What am I doing wrong?

  • 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-05-26T05:32:13+00:00Added an answer on May 26, 2026 at 5:32 am

    even though the same code is executed, the address url doesn’t change
    to the above

    You are using an Ajax.ActionLink meaning that it will send an AJAX request. The whole point of AJAX is to stay on the same page and not redirect.

    You indicate UpdateTargetId = "detailCustomer" so make sure that in your page you have a container with this id:

    <div id="detailCustomer"></div>
    

    which will be updated with the results of the AJAX call. Also make sure that you have properly included the jquery.unobtrusive-ajax.js script to your page in order for the Ajax.ActionLink helper to do anything useful.

    On the other hand if you want to perform a full postback and change the url of your browser you probably need a standard link:

    Html.ActionLink("Detail", "Details", "Customer", new { id = item.CustomerID }, null)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple controller actions that takes an id public ActionResult Get(int? id) {
I have a simple Ability.rb set up listed below: if user.role? :super_admin can :manage,
I have a controller with an action method as follows: public class InventoryController :
I have a controller defined as: [AcceptVerbs(HttpVerbs.Post)] public JsonResult PostMoreData(DataContracts.Address address, DataContracts.GeoLocation geoLocation) {
I have this controller: def list = { withFormat { xml { render Customer.list()
I have list of books listed on the user's profile from the database,i want
I have several UITextFields listed below each other and would like to move the
I have controller with action new , and I want it to create ActiveRecord::Base
When submitting one form from view, how can i also read or have controller
I have a controller action that is being executed by a link that was

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.