Just had a very bad evening facing this strange problem and searching online even didn't helped thought to ask it here. As the question all said about it i use a model view as a model for my view and i have an index view result method in controller like below: public ViewResult Index(Cart cart, string retuUrl, string
SelectedSizeText, string SelectedColorText)
{
ViewBag.Size = SelectedSizeText;
ViewBag.Color = SelectedColorText;
retu View(new CartIndexViewModel
{
RetuUrl = retuUrl,
Cart = cart,
});
}
I have placed breakpoints to see if the data is loaded in this ViewResult and yes i get the data until here, from here then the data is not passed to the view for some unknown reasons. It became more strange when i look at another application having the same controller and view but i can get the data on the other application view. Here is how the view looks like but i have removed some parts for brevity.
@model Ozhay.Domain.Entities.CartIndexViewModel
<table>
@foreach (var line in Model.Cart.Lines)
{
<tr>
<td class="goods-page-image">
<a href="#"><img src="@Url.Action("GetMainPicture", "Product", new {line.Product.ProductID })" alt="Berry Lace Dress"></a>
</td>
<td class="goods-page-description">
<h3><a href="javascript:;">Cool green dress with red bell</a></h3>
<p><strong>@line.Product.ProductName</strong> - @line.Product.ProductDescription</p>
<br />
<strong>Size | @ViewBag.Size</strong>
<br />
<strong>Color | @ViewBag.Color</strong>
</td>
<td class="goods-page-quantity">
<div class="product-quantity">
<p><strong>@line.Quantity</strong></p>
</div>
</td>
<td class="goods-page-price">
<strong><span>AFN</span>@line.Product.ProductPrice</strong>
</td>
<td class="goods-page-total">
<strong><span>AFN</span>@(line.Quantity * line.Product.ProductPrice)</strong>
</td>
<td></td>
<td class="del-goods-col">
@using (Html.BeginForm("RemoveFromCart", "Cart"))
{
@Html.Hidden("ProductId", line.Product.ProductID)
@Html.HiddenFor(x => x.RetuUrl)
<input id="delete" type="submit" class="btn btn-danger" value="Remove" />
}
</td>
</tr>
}
</table>
Just wondering why this happens and what can i do to solve the issue?
Thanks!
