Skip to content

How to Dispaly ProductImage,ProductName and Price from Database in MVC Asp.net

Bvenkat Jeewesh

Bvenkat Jeewesh

Asked Jul 12, 2012, 12:59 PM EDT1 answer
Share
LinkedInX
I am Creating OnlineSharee Website.I have Created ThumbnailImage, I want to  Display In Div tag ProductImage,ProductName and ProductPrice from Database in MVC Asp.net.How can I do it.
Please send me sample code.

Regards
Bvenkat Jeewesh

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Its from my project. Please see:

    @model SportStore.WebUI.Models.productListViewModel

    @{
        ViewBag.Title = "Products";
    }

    @foreach (var p in Model.Products)
    {
        Html.RenderPartial("ProductSummary", p);
    }

    @Html.PageLinks(Model.PagingInfo, x => Url.Action("List",
        new { page = x, category=Model.CurrentCatregory }))


    Its Partitial view product summary:

    @model SportStore.Domain.Entities.Product


      

    @Model.Name


       @Model.Description
      
       @using(Html.BeginForm("AddToCart", "Cart"))
       {
           @Html.HiddenFor(x => x.ProductID);
           @Html.Hidden("returnUrl", Request.Url.PathAndQuery);
          
       }
      
      
    @Model.Price.ToString("c")

    0