Custom grid using Telerik pluggin in nopcommerce 2.8

Thread is closed for posting
1 posts, 0 answers
  1. Sandeep
    Sandeep avatar
    2 posts
    Member since:
    Apr 2013

    Posted 04 Apr 2013 Link to this post

    Iam working on nopcommerce2.8 version. I have a problem with telerik plugin implementation to create new grid.
    Iam implementing a concept where for a product i want to give different price for different customer. So to assign new price for different customers, in admin panel i am creating a grid in edit productvariant page using telerik. I have created a new tab to display these details. Iam able to display customer name and price in grid, but i am not able to call update function, when i click on update button after editing a row. I have created new model to save the customer and price details. Please help me to solve this update problem.
    The model, view and controller of my nopcommerce in given below.

    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Web.Mvc;
    using FluentValidation.Attributes;
    using Nop.Admin.Models.Customers;
    using Nop.Admin.Validators.Catalog;
    using Nop.Web.Framework;
    using Nop.Web.Framework.Localization;
    using Nop.Web.Framework.Mvc;
    using Telerik.Web.Mvc;

    namespace Nop.Admin.Models.Catalog
    public partial class CustomerProductPriceModel : BaseNopModel
    public int Customer_Id { get; set; }
    [NopResourceDisplayName("Customer Name")]
    public string Customer_name { get; set; }

    public decimal Price { get; set; }

    public string Units { get; set; }


    // view

    .DataKeys(x =>
    x.Add(y => y.Customer_Id);
    .DataBinding(dataBinding =>
    .Select("CustomerProductPriceList", "ProductVariant", new { productVariantId = Model.Id })
    .Update("CustomerPriceUpdate", "ProductVariant", new { productVariantId = Model.Id });
    .Columns(columns =>
    columns.Bound(y => y.Customer_name).Width(200).ReadOnly();
    columns.Bound(y => y.Price).Width(100);

    columns.Command(commands =>

    .Editable(x =>


    // controller

    [GridAction(EnableCustomBinding = true)]
    public ActionResult CustomerPriceUpdate(GridCommand command, CustomerProductPriceModel model, int productVariantId)
    if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
    return AccessDeniedView();

    return CustomerProductPriceList(command, productVariantId);

    [HttpPost, GridAction(EnableCustomBinding = true)]
    public ActionResult CustomerProductPriceList(GridCommand command, int productVariantId)
    if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
    return AccessDeniedView();

    var productVariant = _productService.GetProductVariantById(productVariantId);
    if (productVariant == null)
    throw new ArgumentException("No product variant found with the specified id");

    var CustomerPrices = PrepareCustomerProductPriceModel(productVariant.Product.Id);
    var CustomerPricesa = CustomerPrices
    .Select(x =>
    return new CustomerProductPriceModel()
    Customer_Id = x.Customer_Id,
    Price = x.Price,
    Units = x.Units,
    Customer_name = x.Customer_name
    var model = new GridModel
    Data = CustomerPricesa,
    Total = CustomerPrices.Count
    return new JsonResult
    Data = model

Back to Top