The model binder parses request data into objects. When you use a div
there's no request data, nothing posted to the server. You could use a form with input fields in order to send request parameters that could be handled by the model binder and converted into object:
<% using (Html.BeginForm()) { %>
<div id="name"><%= Html.TextBoxFor(x => x.Name) %></div>
<input type="submit" value="OK" />
<% } %>
Or use an anchor:
<%= Html.ActionLink("send to server", "index", new { Name = "some name to send" }) %>
Another option would be to send the request using AJAX:
$(function() {
$.ajax({
url: '/home/index',
data: { name: $('#name').html() },
success: function(result) {
alert('success');
}
});
});