Hi Gokala,
Based on the shared details we can understand that you are
trying to utilize Syncfusion Blazor Dropdown Tree component. We have
prepared the sample and achieved your requirement by using the Dropdown Tree
component’s ValueChanging
event. Kindly refer the code changes below,
|
<SfDropDownTree TItem="ProductCategory" TValue="int?" ID="list" Placeholder="Select a Category" PopupHeight="200px" ValueChanging="OnValueChanging">
<DropDownTreeField TItem="ProductCategory" DataSource="@Categories" ID="Id" ParentID="ParentId" Text="Name" HasChildren="HasChild" Expanded="Expanded"></DropDownTreeField>
</SfDropDownTree>
public
void OnValueChanging(DdtChangeEventArgs<int?> args)
{
count++;
ProductCategory product = Categories.Find(x => x.Id == args.CurrentValue);
product.HasChild = true;
Categories.Add(new() { Id = count, Name = "New Name " + count,
ParentId = args.CurrentValue });
}
|
We have attached the sample for your reference,
Sample: Attached as zip folder
Kindly check out the shared details and get back to us if
you need further assistance.
Regards,
Jafar
Attachment:
DropdownTree_Sample_1feb0b97.zip