Rectangle 27 0

c Open the view in popup in asp.net MVC action click?


var url = '@Url.Action("Details", "Client")';

$('selector').load(url, { id: 1 });

It's not clear on how you are managing the ID's on the main page as there was no HTML markup. The 'selector' is the element you want to fill with the partial view data. Pass the id of the Client (via a click event for example) you want to load into that selector.

Use an ajax call to return the partial view and add it to the DOM.

You can enhance your answer and add an id/class to that action link and use that as selector, this will make the answer more useful:)

Note
Rectangle 27 0

c Open the view in popup in asp.net MVC action click?


$(function () {
    $.ajaxSetup({ cache: false });
    $("a[data-modal]").on("click", function (e) {        
        $('#myModalContent').load(this.href, function () {
            $('#myModal').modal({
                keyboard: true
            }, 'show');
        });
        return false;
    });
});
@Html.ActionLink("View Clients", "Details", "Client", new { id = item.Id }, new { data_modal = "" })

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>
public class ClientController : Controller
{
  public ActionResult Details(long id = 0)
    {
        Client client = db.Clients.Find(id);
        if (client == null)
        {
            return HttpNotFound();
        }
        return PartialView(client);
    }
}

Add custom attribute to the link, use its URL to load the PartialView from controller in the modal form.

Note
Rectangle 27 0

c Open the view in popup in asp.net MVC action click?


$(function () {
    $.ajaxSetup({ cache: false });
    $("a[data-modal]").on("click", function (e) {        
        $('#myModalContent').load(this.href, function () {
            $('#myModal').modal({
                keyboard: true
            }, 'show');
        });
        return false;
    });
});
@Html.ActionLink("View Clients", "Details", "Client", new { id = item.Id }, new { data_modal = "" })

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>
public class ClientController : Controller
{
  public ActionResult Details(long id = 0)
    {
        Client client = db.Clients.Find(id);
        if (client == null)
        {
            return HttpNotFound();
        }
        return PartialView(client);
    }
}

Add custom attribute to the link, use its URL to load the PartialView from controller in the modal form.

Note
Rectangle 27 0

c Open the view in popup in asp.net MVC action click?


var url = '@Url.Action("Details", "Client")';

$('selector').load(url, { id: 1 });

It's not clear on how you are managing the ID's on the main page as there was no HTML markup. The 'selector' is the element you want to fill with the partial view data. Pass the id of the Client (via a click event for example) you want to load into that selector.

Use an ajax call to return the partial view and add it to the DOM.

You can enhance your answer and add an id/class to that action link and use that as selector, this will make the answer more useful:)

Note