Click here to Skip to main content
14,665,104 members
Rate this:
Please Sign up or sign in to vote.
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100