Blazorise: SelectedValue of a SelectList inside a DataGrid's EditTemplate strange behavior

Created on 2 Oct 2019  路  3Comments  路  Source: stsrki/Blazorise

When I'm editing a DataGrid row, using a custom EditTemplate with a SelectList, with it's SelectedValue binded to CellEditContext.CellValue, the SelectedValue displayed doesn't change.

Investigate Bug 馃悶

All 3 comments

updated the demo, push missed :-P

Hi @hybrid2102

Sorry it took so long to get to this. I tried your example and to make it work you just had to set the context.CellValue

Example:

<SelectList Data="@allBrands"
            TextField="@(i => i.Name)"
            ValueField="@(i => i.Id)"
            SelectedValue="@((int)((CellEditContext)context).CellValue)"
            SelectedValueChanged="@(e =>
                                    {
+                                        context.CellValue = Convert.ToInt32(e);
                                    } )" />

The reason for this is that context is used as a proxy for edited values. So you need to set it based on the changed value passed from SelectList through the SelectedValueChanged event handler

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danlbb picture danlbb  路  4Comments

imtrobin picture imtrobin  路  4Comments

stsrki picture stsrki  路  3Comments

njannink picture njannink  路  4Comments

smilyte picture smilyte  路  3Comments