Понятие truthy и значений falsy. Вы не должны делать чего-то как
если (someVar ===, неопределенный || пустой указатель someVar ===)...
Просто сделайте:
, если (! someVar).
Каждое значение имеет соответствующее булево представление.
Вы можете довольно легко сделать это с помощью MVC и jQuery.
Сначала в вашем представлении Orders \ List.aspx
:
<script>
// once the page has loaded
$(function() {
// set up your click event to load data
$('.list-item').click(function() {
// ajax load the content returned by the detail action
$('#detail').load('<%= Url.Action("Detail") %>', { id: this.id } );
});
});
</script>
<style> .list-item { cursor: pointer; } </style>
<% // loop through the orders in your model and show them
// as each div has the class list-item it will be give the click event
foreach( var order in Model ) { %>
<div id="<%= order.Id %>" class="list-item"><%= order.Name %></div>
<% } %>
<%-- the panel that the ajaxed content will be loaded into --%>
<div id="detail"></div>
Затем в вашем Orders \ Detail.ascx
частичное представление:
Id: <%= Model.Id %><br />
Name: <%= Model.Name %><br />
Description: <%= Model.Description %><br />
etc