//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.**
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
}
public class ProductController : Controller
{
// **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=_prodIds ,Products=_Prodcusts},JsonBehaviour.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 (_products)**
// **//how to bind dropdownlist and refresh from json result (_ProductIds)**
}
});