
hi ..
i have a dto class called GroupListDto with just three fields
public class GroupListDto
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
i use this class as kendo grid model ..
when i write my actionresult in below manner . my model field is empty
public ActionResult Create([DataSourceRequest] DataSourceRequest request, GroupListDto group)
but when is use GroupListDto class fields instead , the fields are filled with correct datas
public ActionResult Create([DataSourceRequest] DataSourceRequest request, string Title , string Description)
does anyone know what is the problem ?
why i cant get data in my dto model , but i get data in its fields !?
6 Answers, 1 is accepted

also when i enable batch edit in kendo grid
.Batch(true)
and change the GroupListDto to IEnumerable<GroupListDto> , everything gets correct and i get the list of the data
public ActionResult Create([DataSourceRequest] DataSourceRequest request,
[Bind(Prefix = "models")]IEnumerable<
GroupListDto
> groups)
but as i mentioned before , i dont need batch edit , i just want to get one row of GroupListDto in my controller..
does anyone know what is wrong with my code !?

after spending a lot of time on this issue i found this way .
public ActionResult CreateLite([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models[0]")]GroupListDto group)
by adding models[0] , i was able to get the edited recored data ..
but i think [Bind(Prefix = "models[0]") is something extra and must be removed from my actionresult ..
who knows the answer of my problem? :(((
Thank you for providing all of the details when researching the issue.
The only thing that I noticed is that the following decorator is missing:
[AcceptVerbs(HttpVerbs.Post)]
Please observe all of the code in our Inline edit demo without Batch enabled:
https://demos.telerik.com/aspnet-core/grid/editing-inline
Also, observe if the requests in the network tab are in different format.
Additionally, providing a runnable example will help us test it locally and make a suggestion best suited for it.
Regards,
Stefan
Progress Telerik

