Click here to Skip to main content
13,047,567 members (59,033 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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<customerproductpricemodel>
                Data = CustomerPricesa,
                Total = CustomerPrices.Count
            return new JsonResult
                Data = model
Posted 3-Apr-13 20:26pm
Updated 4-Apr-13 2:22am
Maciej Los255.3K
Sandeep Mewara 4-Apr-13 12:44pm
Looked at telerik forum?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 4 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100