Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//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)**
}
});
Posted

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