I am trying to execute ASP.NET MVC 2 by going through the NerdDinner tutorial. But, apparently, version 2 of MVC does not create the details page in the same way as in the tutorial, and you get divs with css classes on them in style. However, I want to get a style in which each label will follow on the same line with the field, and I cannot do this, I get them one above the other, or if I try to use floats, strange things happen (maybe because that I donβt know exactly how to use it in this situation, where every other div should be on the same line). Here is the generated html for the Details page:
<fieldset> <legend>Fields</legend> <div> <div class="display-label">DinnerID</div> <div class="display-field"><%: Model.DinnerID %></div> <div class="display-label">Title</div> <div class="display-field"><%: Model.Title %></div> <div class="display-label">EventDate</div> <div class="display-field"><%: String.Format("{0:g}", Model.EventDate) %></div> <div class="display-label">Description</div> <div class="display-field"><%: Model.Description %></div> <div class="display-label">HostedBy</div> <div class="display-field"><%: Model.HostedBy %></div> <div class="display-label">ContactPhone</div> <div class="display-field"><%: Model.ContactPhone %></div> <div class="display-label">Address</div> <div class="display-field"><%: Model.Address %></div> <div class="display-label">Country</div> <div class="display-field"><%: Model.Country %></div> <div class="display-label">Latitude</div> <div class="display-field"><%: String.Format("{0:F}", Model.Latitude) %></div> <div class="display-label">Longitude</div> <div class="display-field"><%: String.Format("{0:F}", Model.Longitude) %></div> <div class="display-label">IsValid</div> <div class="display-field"><%: Model.IsValid %></div> </div> </fieldset>
How to get a display label and a display field for each "record" to display on one line?
css asp.net-mvc
Anders
source share