Click here to Skip to main content
15,861,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
@model ProductModel

@if (Model.Id > 0)
{

<table class="adminContent">
        <tr>

<td>
    <div id="customers-grid"></div>
 <script>
     $(document).ready(function () {
         $("#customers-grid").kendoGrid({
             dataSource: {
                 type: "json",
                 transport: {
                     read: {
                         url: "@Html.Raw(Url.Action("ProductCustomPriceModelList", "Product", new { productId = Model.Id }))",
                     type: "POST",
                     dataType: "json",
                     data: addAntiForgeryToken
                 }
                    ,
                 update: {
                     url:"@Html.Raw(Url.Action("ProductCustomPriceModelUpdate", "Product"))",
                 type: "POST",
                 dataType: "json",
                 data: addAntiForgeryToken
             },
             destroy: {
                 url: "@Html.Raw(Url.Action("ProductCustomPriceModelDelete", "Product"))",
             type: "POST",
             dataType: "json",
             data: addAntiForgeryToken
         }
             },
             schema: {
                 data: "Data",
                 total: "Total",
                 model: {
                     id: "Id",
                     fields: {
                         Id: { type: "number" },
                         CurrencyId: {editable: false, type: "number" },
                         Price: {editable: true, type: "number" },
                         OldPrice: {editable: true, type: "number" },
                         ProductCost: {editable: true, type: "number" },
                         SpecialPrice: {editable: true, type: "number" },
                         SpecialPriceStartDateTimeUtc: {editable: true, type: "date" },
                         SpecialPriceEndDateTimeUtc: {editable: true, type: "date" }
                         }
                 }
     },
             error: function(e) {
                 display_kendoui_grid_error(e);
                 // Cancel the changes
                 this.cancelChanges();
             },
             pageSize: 10,
             serverPaging: true,
             serverFiltering: true,
             serverSorting: true
         },
             pageable: {
             refresh: true,
             pageSizes: 10
             },
         scrollable: false,
         columns: [
                 {
                     field: "CurrencyId",
                     title: "CurrencyId",
                     //integer format
                     //format: "{0:0}",
                     width: 50
                 }, {
                     field: "Price",
                     title: "Price",
                     //integer format
                     //format: "{0:0}",
                     width: 50
                 }, {
                     field: "OldPrice",
                     title: "OldPrice",
                     //integer format
                     ///format: "{0:0}",
                     width: 50
                 }, {
                     field: "ProductCost",
                     title: "ProductCost",
                     //integer format
                     // format: "{0:0}",
                     width: 50
                 }, {
                     field: "SpecialPrice",
                     title: "SpecialPrice",
                     //integer format
                     //format: "{0:0}",
                     width: 50
                 },  {
                     field: "SpecialPriceStartDateTimeUtc",
                     title: "SpecialPriceStartDateTimeUtc",
                     type: "date",
                     format: "{0:G}",
                     width: 50
                 }, {
                     field: "SpecialPriceEndDateTimeUtc",
                     title: "SpecialPriceEndDateTimeUtc",
                     type: "date",
                     format: "{0:G}",
                     width: 50
                 }
,
                   { command: ["edit", "destroy"], title: "&nbsp;", width: "160px" }
         ]
     });
     });


                    </script>
            </td>
        </tr>
    </table>
}
else
{
  No Data
}
Posted
Updated 6-Sep-15 8:00am
v3
Comments
Passion4Code 7-Sep-15 4:08am    
Hello Atul,
Nothing is clear from your post. Please elaborate
Thanks
atulonweb@gmail.com 7-Sep-15 4:15am    
Hi,I have posted entire code of my MVC view but seems it has size limit. Share I share it with you?

Edit link in my kendo grid is not converting row in to editable.
Passion4Code 7-Sep-15 4:17am    
Ok Do you have Selectable set to true in the grid?
Passion4Code 7-Sep-15 4:18am    
You can only post the Kendo Grid declaration section here.
atulonweb@gmail.com 7-Sep-15 4:31am    
@model ProductModel

@if (Model.Id > 0)
{

<table class="adminContent">
<tr>

<td>
<div id="productmanufacturers-grid"></div>
<script>
$(document).ready(function () {
$("#productmanufacturers-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("ProductCustomPriceModelList", "Product", new { productId = Model.Id }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
create: {
url: "@Html.Raw(Url.Action("ProductManufacturerInsert", "Product", new { productId = Model.Id }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
update: {
url:"@Html.Raw(Url.Action("ProductCustomPriceModelUpdate", "Product"))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
url: "@Html.Raw(Url.Action("ProductCustomPriceModelDelete", "Product"))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
}
},
schema: {
data: "Data",
total: "Total",
errors: "Errors"
},
requestEnd: function (e) {
if (e.type == "create" || e.type == "update") {
this.read();
}
},
error: function (e) {
display_kendoui_grid_error(e);
// Cancel the changes
this.cancelChanges();
},
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
pageable: {
refresh: true,
numeric: false,
previousNext: false,
info: false
},
toolbar: ["create"],
edit: function(e) {
if (e.model.isNew()) {
//little hack here
//pre-select the first value of kendoui dropdownlist datasource
//for some reasons (maybe, bug) it always sends 0
//if no value has been selected (changed) in the dropdownlist
if (allManufacturers.length > 0) {
e.model.ManufacturerId = allManufacturers[0].Id;
}
}
},
editable: {
confirmation: false,
mode: "inline"
},
scrollable: false,
columns: [{
field: "CurrencyId",
title: "@T("Admin.Catalog.Products.Manufacturers.Fields.Manufacturer")",
width: 200
},

{
field: "CurrencyId",
title: "@T("Admin.Catalog.Products.Manufacturers.Fields.DisplayOrder")",
width: 200,
//integer format
format: "{0:0}"
}, {
command: [{
name: "edit",
text: "@T("Admin.Common.Edit")"
}, {
name: "destroy",
text: "@T("Admin.Common.Delete")"
}],
width: 200
}]
});
});

</script>
</td>
</tr>
</table>
}
else
{
@T("Admin.Catalog.Products.AssociatedProducts.SaveBeforeEdit")
}

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900