Using a new view I have recreated a Telerik Ui an example in the Administration of NopCommerce. I need to be able to use both the Product Model and the ProductVariant Model. With the following code there is small error that I can't get my head around..
The type or namespace name 'ProductVariantModel' could not be found (are you missing a using directive or an assembly reference?)
Within the Code I am using
@model Nop.Web.Models.Catalog.ProductModelis it all possible I can use both The ProductModel and the ProductVariant Model I have wrote a foreach statement to reach over to the ProductVariant Model. As seen in the code but I am still recieving the error. If anyone could please help i would highly appreicated.
@model Nop.Web.Models.Catalog.ProductModel
@using Nop.Web.Models.Catalog
@using Telerik.Web.Mvc.UI
@using (Html.BeginForm())
{
<table class="concord-products">
<tr>
<td>
@(Html.Telerik().Grid<ProductModel>(Model.Products)
.Name("concord-products")
.Columns(columns =>
{
columns.Bound(x => x.DefaultPictureModel)
.Template(
@<text>
<a href ="javascript:OpenWindow('@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName, formId = "Product-Form" }))', 700, 400, true);"
title ="Model.DefaultPictureModel.Title" /> <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
@</text>
)
.ClientTemplate("< img alt='<#= DefaultPictureModel.AlternateText #>' src='<#= DefaultPictureModel.ImageUrl #>' />");
columns.Bound(x => x.Name);
columns.Bound(x => x.CCCStockCode);
columns.Bound(x => x.CCCPack);
columns.Bound(x => x.CCCMRP)
.Width(100);
});
foreach (var product in Model.ProductVariantModels)
{
Html.Telerik().Grid<ProductVariantModel>(Model.ProductVariantModels)
.Name("concord-products")
.Columns(columns =>
{
columns.Bound(pv => pv.Price)
.Width(100);
columns.Bound(pv => pv.StockQuantity)
.Width(100);
columns.Bound(pv => pv.AddToOrder)
.Template(
@<text>
<input type="text" id="quantity_@(Model.Id)" size="1" />
</text>
)
.ClientTemplate("<input type='text' size='1' id='<#=quantity_Id#>'/>");
});
}
</td>
</tr>
<tr>
<td>
<input type="button" value="@T("Order")" class="productlistaddtocartbutton" onclick="setLocation('@(@Url.RouteUrl("AddProductToCartQty", new { productId = Model.Id }))/' + $('#quantity_@(Model.Id)').val())" />
</td>
</tr>
</table>
}
Kind regards
Richard.