I think issue might be with case of ID
change ID
to id
public ActionResult Categor(int? id)
{
return Json(categories, JsonRequestBehavior.AllowGet);
}
Question
I am Using kendo UI Treeview, there is ajax call of post method , in browser i see there is id=xx value pass but when i check by debug point in actionmethod i can't get value there is null why?
i have put code am i doing something wrong?
//View page code
@(Html.Kendo().TreeView()
.Name("treeview1")
.DragAndDrop(true)
.DataTextField("Name")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Categor", "CategorySet")
))
Controller Code
public ActionResult Categor(int? ID)
{
return Json(categories, JsonRequestBehavior.AllowGet);
}
Browser Code means ajax call
GET http://www.xyz.com/Admin/CategorySet/Categor?id=2 200 OK 96ms
See in url there is ?id=2 But in Action method i can't get this 2. Why. ? How to solve this?
Thank you in advance Vinit
Solution
I think issue might be with case of ID
change ID
to id
public ActionResult Categor(int? id)
{
return Json(categories, JsonRequestBehavior.AllowGet);
}
OTHER TIPS
You pass the wrong call:
try this:
GET http://www.xyz.com/Admin/CategorySet/Categor?ID=2 200 OK 96ms
instead of this:
GET http://www.xyz.com/Admin/CategorySet/Categor?id=2 200 OK 96ms
For Ex:
Parent1 ID 7--> Child1 ID 8
Parent2 ID 9--> Child2 ID 6--> SubChild1 ID 5
On First Load id's will be NULL if you press Continue(F5) on second call you will receive ID 7 to get its children .. like this this action will be called until you reach last child
Hope you got it.. because its working fine for me