How to Grid EditDialog Template with Enum DropDown?
Dear Syncfusion Team
I try to create a custom edit dialog for the data grid that has a dropdown for enum values. But sadly based on the documentation of enum data binding for the dropdown list I'm not able to make it work and receiving the error below. https://blazor.syncfusion.com/documentation/dropdown-list/data-source/#enum-data-binding
How has the code to look like when i want to have a edit dialog within the data grid that has his data source based on a list of enum?
Btw. I'm using the latest blazor nuget package release.
Thanks in advance
public enum RoomType
{
SINGLE = 1,
DOUBLE = 2
}
SIGN IN To post a reply.
4 Replies
SR
Sergio Ramos
April 20, 2020 10:33 AM UTC
Dear Syncfusion
I've searched the whole weekend for a solution but couldn't figured out how to make it work. Can you please provide me an example on this and in the same it would be glad for everyone if you could also extend the example https://blazor.syncfusion.com/demos/datagrid/grid-dialog-template?theme=material
Thank you soo much for your answer :)
RS
Renjith Singh Rajendran
Syncfusion Team
April 20, 2020 11:36 AM UTC
Hi Sergio,
Thanks for contacting Syncfusion support.
We have prepared a sample to perform dialog template editing with Dropdown enum values. We are attaching the sample for your convenience, please download the sample from the link below,
And also to update the value selected from dropdown to Grid, we suggest you to bind the OnActionBegin event handler of Grid and update the “Status” field value in that event handler to get the selected value from dropdown to get updated in Grid. Please refer the code below,
|
<GridEvents OnActionBegin="OnActionBegin" TValue="WeatherForecast"></GridEvents>
public void OnActionBegin(ActionEventArgs<WeatherForecast> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
Args.Data.Status = (WeatherForecastState)Enum.Parse(typeof(WeatherForecastState), DropDownList.Value);
}
}
|
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.
SR
Sergio Ramos
April 21, 2020 02:08 PM UTC
Dear Renjith Singh Rajendran
Thank you very much for your example it solved my problem.
Best regards
Sergio
RS
Renjith Singh Rajendran
Syncfusion Team
April 22, 2020 04:29 AM UTC
Hi Sergio,
Thanks for your update.
We are glad to hear that the provided suggestion helped you in achieving your requirement.
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
SR Sergio Ramos
- Apr 17, 2020 11:42 AM UTC
- Apr 22, 2020 04:29 AM UTC