I'm using remote binding, but not appears arrow to expand node.
This is method
public
JsonResult Read_DropDownTreeNewCustomerCategoriesData(
string
Code)
{
var result = GetHierarchicalNewCustomerCategoryData()
.Where(x => !
string
.IsNullOrEmpty(Code) ? x.ParentCode == Code : x.ParentCode ==
null
)
.Select(item =>
new
{
Code = item.Code,
Name = item.Name,
hasChildren = item.HasChildren
});
return
Json(result.ToList());
}
This is control
@(Html.Kendo().DropDownListFor(model=>model.NewCustomerCategoryCode)
.DataTextField("Name")
.DataValueField("Code")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Read_DropDownTreeNewCustomerCategoriesData", "ListBox")
)
)
)
I attached result
9 Answers, 1 is accepted

this is the model
public
class
NewCustomerCategory
{
public
string
Code {
get
;
set
; }
public
string
ParentCode {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
bool
HasChildren {
get
;
set
; }
}
this is a provider
public
IList<NewCustomerCategory> GetHierarchicalNewCustomerCategoryData()
{
var newCustomerCategories = from rec
in
_context.DimensionValues
where rec.DimensionCodeFK ==
"CAT.CLIENTE NUOVO"
&& rec.DimensionValueType != 4
orderby rec.Code, rec.Indentation
select rec;
var result =
new
List<NewCustomerCategory>();
foreach
(var item
in
newCustomerCategories.Where(dv => dv.Indentation == 0 && dv.DimensionValueType == 3))
{
var newItem =
new
NewCustomerCategory();
newItem.Code = item.Code;
newItem.Name = item.Name;
newItem.ParentCode =
null
;
newItem.HasChildren =
false
;
//Secondo livello
foreach
(var item2
in
newCustomerCategories.Where(dv => dv.Code.StartsWith(newItem.Code.Substring(0,1).ToString()) && dv.Indentation == 1 && dv.DimensionValueType == 3))
{
var newItem2 =
new
NewCustomerCategory();
newItem2.Code = item2.Code;
newItem2.Name = item2.Name;
newItem2.ParentCode = newItem.Code;
newItem2.HasChildren =
false
;
newItem.HasChildren =
true
;
//Terzo livello
foreach
(var item3
in
newCustomerCategories.Where(dv => dv.Code.StartsWith(newItem2.Code.Substring(0, 3).ToString()) && dv.Indentation == 2 && dv.DimensionValueType == 0))
{
var newItem3 =
new
NewCustomerCategory();
newItem3.Code = item3.Code;
newItem3.Name = item3.Name;
newItem3.ParentCode = newItem2.Code;
newItem3.HasChildren =
false
;
newItem2.HasChildren =
true
;
result.Add(newItem3);
}
result.Add(newItem2);
}
result.Add(newItem);
}
result = result.OrderBy(x => x.Code).ToList();
return
result;
}
Hi Dario,
According to the provided code snippets a DropDownList is being initialized instead of a DropDownTree:
@(Html.Kendo().DropDownListFor(model=>model.NewCustomerCategoryCode)
.DataTextField("Name")
.DataValueField("Code")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Read_DropDownTreeNewCustomerCategoriesData", "ListBox")
)
)
)
Please change the widget instance to a DropDownTree and let me know if this resolves the issue.
You can also refer to the Remote Data Binding example for further details.
Regards,
Aleksandar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

I changed code in this way:
<
div
class
=
"form-group"
>
<
label
asp-for
=
"NewCustomerCategoryCode"
class
=
"control-label"
></
label
>
@(Html.Kendo().DropDownTreeFor(model=>model.NewCustomerCategoryCode)
.DataTextField("Name")
.DataValueField("Code")
.AutoWidth(true)
.HtmlAttributes(new { style = "width: 100%" })
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Read_DropDownTreeNewCustomerCategoriesData", "ListBox")
)
)
)
<
span
asp-validation-for
=
"NewCustomerCategoryCode"
class
=
"text-danger"
></
span
>
</
div
>
But I have same effect
Hello Dario,
I reviewed the updated code and indeed the configuration looks correct. I tried to reproduce the issue but without success. Can you take a look at the attached sample project, modify it so the issue is replicated and send it back to me for further investigation?
Regards,
Aleksandar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Hi Aleksandard,
I can't use your solution because I'm using Core 3.1
I would attached a solution that gives me the issue, it doesn't accept zip file.
Hello Dario,
In general, you should be able to attach a zip file to a forum post. You might get an error if the file is too large, so I suggest removing any unnecessary data and trying again. If you still experience an issue you can upload it in a storage location of your choice.
The approach demonstrated in the sample would be applicable in an ASP.NET Core 3.1 app as well. I have made such an example as well.
Regards,
Aleksandar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

