Reset dropdown in grid row after event

Hi there - I have a sample app attached where I'd like to reset the dropdown control to 'Select one...' after either the dialog is canceled or the dropdown update event has completed.


Is there a way to rebind the row and/or dropdown data? Thank you.


Attachment: BlazorApp_b2fddeae.zip


3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team September 8, 2021 11:27 AM UTC

Hi Gordon, 

Greetings from Syncfusion support. 

We have modified the sample based on this requirement, please download and refer the sample from the link below, 
 
In above sample, we have maintained separate references for the SfDropDownList rendered inside Grid Template. Now by using these references, we have called the ClearAsync method of Dropdown to clear the input box. 

Please refer the highlighted codes below, 

<GridColumn HeaderText="Customer Name" Width="150"> 
    <Template> 
        @{ 
            var id = context as Order; 
        } 
        <SfDropDownList Placeholder="Select one..." @ref="DropRef[id.OrderID]" TItem="KeyValuePair<stringint>" TValue="int" DataSource="GetData()"> 
            <DropDownListEvents TValue="int" TItem="KeyValuePair<stringint>" ValueChange="(e) => ValueChangehandler(e, id.OrderID)" /> 
            <DropDownListFieldSettings Value="Value" Text="Key" /> 
        </SfDropDownList> 
    </Template> 
</GridColumn> 

private Dictionary<int?, SfDropDownList<int,KeyValuePair<stringint>>> DropRef =      new Dictionary<int?, SfDropDownList<int,KeyValuePair<stringint>>>();  //for storing DropDownList reference dynamicallypublic int? UniqueDropKey { getset; }public async Task ValueChangehandler(Syncfusion.Blazor.DropDowns.ChangeEventArgs<intKeyValuePair<stringint>> args, int? UniqueKey){    ...    UniqueDropKey = UniqueKey;    this.DialogVisible = true;} async Task Dialog_OnUpdate(){    ...     await DropRef[UniqueDropKey].ClearAsync();    this.DialogVisible = false;}

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Marked as answer

GO Gordon September 8, 2021 02:59 PM UTC

I had no idea you could do that...You guys are full of knowledge! I hope you all get a huge bonus this year :)


Thank you.



RS Renjith Singh Rajendran Syncfusion Team September 9, 2021 05:22 AM UTC

Hi Gordon, 

Thanks for your update. Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon