I have to update name of an item which is displayed in card.I need to update the name and send to data base how i can do?
C#
@foreach (var item in FileList)
{
////how to upate below name feild and that should be updated in list also
@item.Name
}
Naimish MakwanaRank #324 · 7.7K reputationPosted Feb 2, 2023, 4:20 AM EST
Please refer below link. That might be help to you.
https://stackoverflow.com/questions/55775060/blazor-component-refresh-parent-when-model-is-updated-from-child-component
Thanks.
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 2, 2023, 4:09 AM EST
But i have db operation in parent component.How i can update FileList name vale and send to parent
@code { [Parameter] public IReadOnlyList FileList{ get; set; } = Array.Empty(); }Naimish MakwanaRank #324 · 7.7K reputationPosted Feb 2, 2023, 3:57 AM EST
Hello Sujit,
You can use the
@oninputevent to achieve this.UpdateName(e, item))">Then Implement the UpdateName method in the code-behind file to update the item name.
private void UpdateName(ChangeEventArgs args, Item item) { item.Name = args.Value.ToString(); //Send data to DB. }Thanks
Naimish Makwana