Is it possible to use async functions on Grid Dialog Edit Template?

Greetings!

On my grid, when the user clicks to edit an item, I'd like to load some additional data do be displayed.

I'm trying to make it inside the Template tag, but it seems like I can't use async functions properly.

I must declare the functions inside the <Template> tag because of the context. I can't access the item being edited outside he Grid <Template>

The error message says: "The 'await' operator can only be used within an async lambda expression. Consider marking this lambda expression with the 'async' modifier."


 As I try to use a async lambda expression this message appears: " Only assignment, call, increment, decrement, and new object expressions can be used as a statement "


I'm sure I'm doing something wrong, but I'm not sure where.

Could you please give me some help?


1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team May 19, 2022 07:06 AM UTC

Hi Consensu,


Greetings from Syncfusion support.


Based on this scenario, we suggest you to render the contents of Dialog Template inside the dialog as a sperate component. We have already discussed a similar topic to render dialog template contents as a separate component in the below thread. Please refer the below link for more details on this requirement.

https://www.syncfusion.com/forums/167931/can-you-use-a-seperate-component-as-the-template-for-editmode-dialog?reply=SEJvlG


Now you can call your async methods inside this separate component to achieve this requirement. Please try this from your side and get back to us if you need further assistance.


Regards,

Renjith R


Marked as answer
Loader.
Up arrow icon