These doesn't make any sense why?

Feb 9, 2012 at 2:54 AM
Edited Feb 9, 2012 at 2:58 AM


@foreach (var vehicle in Model.Vehicles)
            <div class="wrapper">
                <div data-vehicle-id="@vehicle.VehicleId" class="vehicle section @Html.CssClassForTile(Model,vehicle)">


What does this mean class="vehicle section @Html.CssClassForTile(Model,vehicle)">


Because it use jQueryTemplate rather that code. And i did not understand that line. It would look like @class="className.

That look strange than other usage.


That loop 16x Actually it should be 8. When modified links at _VehicleList.cshtml


//This execute twice because it render at server and client (jQueryTemplate) x2
                switch (action) {
                    case 'vehicle-details-selected':
                        state.layout = 'details'; //hit 16 time
                    case 'vehicle-fillups-selected':
                        state.layout = 'fillups'; //hit 8 time
                    case 'vehicle-reminders-selected':
                        state.layout = 'reminders';
                    case 'vehicle-add-selected':
                        state.layout = 'addVehicle';
                        state.vid = undefined;
                $this.attr('href', $.param.fragment(newUrlBase, state));

Feb 9, 2012 at 7:44 PM
Edited Feb 9, 2012 at 8:03 PM


Regarding your first concern, as far as I know this line:

 <div data-vehicle-id="@vehicle.VehicleId" class="vehicle section @Html.CssClassForTile(Model,vehicle)">

Benefits from the use of the HTML helper extension method, that generates a string, that represents a class name based on the arguments passed to it (VehicleListViewModel list, VehicleModel vehicle), unlike Html.ActionLink which generates an entire HTML tag.

On the other hand, as for your second concern, we believe the 'details' being hit twice, seems to be related to the fact that each vehicle contains two links to the detail panel, one in the Details button and the other in each vehicles' Photo.


Agustin Adami

Feb 9, 2012 at 8:05 PM
Edited Feb 9, 2012 at 8:12 PM

Hi aadami,

Thanks again.