sreenivasa k

sreenivasa k

  • 819
  • 891
  • 32k

Kendo dropdownlist & kendo grid binding & refresh with json

Apr 3 2015 11:53 PM
**1. when page load, all products ids bind to dropdownlist. when user select a product id from dropdownlist and click on Add button then corresponding product details would add to grid and same product id delete from the dropdown list.
2. When user remove a product from grid (by using remove link) then corresponding product id would added back to dropdownlist.**

**Model:**
public class ProductModel
{
public List<long>ProdIds {get;set;} //list of product id's - bind to kendo dropdownlist

public List<Products> Products{get;set;}//list of products bind to kendo grid
}
**Controller:**
public JsonResult RefreshDatata(long Id)
{
var model = new ProductModel();
_prodIds = model.ProdIds.add(id);

_products = model.Products.Removeat(Products.FirstOrDefault(x=>x.ProductId==id))

return Json(new {ProdIds:_products,Products:_Prodcusts},JasonBehaviour.AllowGet());
}

**View(.cshtml)**
$.ajax({
type: "POST",
url: "RefreshDatata/Product",
data:
{
id: id,
},
success: function(result)
{
**//how to bind kendo grid and refresh from json result (_prodIds)**
**//how to bind dropdownlist and refresh from json result (_Prodcusts)**
}
});

Answers (1)