This is a migrated thread and some comments may be shown as answers.

Grid binding difference...

0 Answers 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 15 Jul 2012, 05:04 PM

What is the difference between this line:
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ClientOrderViewModel>()

and this line:
@(Html.Kendo().Grid(Model)

I thought the first one is if you are connecting to a remote datasource. I tried the first one and it only seems to work if you are using json. I'm using the second and it is working for me.

Here is what my controller code looks like that works with the 2nd one and not the first.

public ActionResult Index(string classifications = "")
        {
            ViewData["Category"] = classifications;
            ViewData["Classifications"] = new SelectList(Classifications.List, "ClassificationText", "ClassificationText", classifications);
            var codModels = new List<CodeModel>();
            ViewBag.SelectedCatgory = classifications ?? "Type";
 
            if (Request.HttpMethod == "POST")
            {
                var model = _codeRepository.Search(classifications).ToModel();
                return View(model);
            }
 
            return View(codModels);
        }

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Share this question
or