try adding
$( "#DivToAppendPartialView" ).dialog( "open" );
at the end of the click event.
try this
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Test</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function () {
$('.detail-user').on("click", function () {
alert('test');
// var tr = $(this).parents('tr:first');
var UserName = 'somehardcoded';// tr.find("#username").val();
var _url = "@Url.Action("DetailUser", "Home")" + "?username=" + UserName;
$("#DivToAppendPartialView").load(_url, function () {
alert('loaded');
$("#DivToAppendPartialView").dialog('open');
});
});
$("#DivToAppendPartialView").dialog({
autoOpen: false,
modal: true,
width: 500,
height: 438,
title: "Detail User",
resizable: false
});
});
</script>
</head>
<body>
<div>
<input type="button" class="detail-user" value="Print" />
</div>
<div id="DivToAppendPartialView" style="display:none"></div>
</body>
</html>
modify for your needs, let me know if u face any issue, it works fine for me