In my custom edit template, I'm trying to pass InventoryImageSeq from the model to an action on the controller. This is used to retreive the image for the inventory item.
Here's my custom editor. model.DeviceName displays correctly. The <img... line does call GetImage in the controller, however inventoryImageSeq is always null.
Here's GetImage in CellInventoryContoller.cs:
Is this a problem with my syntax for the routeValues:
or is something else wrong?
Thanks,
Jerry
Here's my custom editor. model.DeviceName displays correctly. The <img... line does call GetImage in the controller, however inventoryImageSeq is always null.
@model Copper.Domain.Entities.EntInventory<div class="editor-label"> @Html.LabelFor(model => model.DeviceName)</div><div class="editor-field"> @Html.EditorFor(model => model.DeviceName)</div><div> <img alt="" src="@Url.Action("GetImage", "CellInventory", new { inventoryImageSeq = Model.InventoryImageSeq })" /></div>Here's GetImage in CellInventoryContoller.cs:
public FileContentResult GetImage(string inventoryImageSeq){ EntInventoryImage entImage = new EntInventoryImage(); int seq; if (Int32.TryParse(inventoryImageSeq, out seq)) { entImage = _margoRepository.GetInventoryImage((int?)seq); } return File(entImage.ActualImage, entImage.ContentType);}Is this a problem with my syntax for the routeValues:
new { inventoryImageSeq = Model.InventoryImageSeq }or is something else wrong?
Thanks,
Jerry