How to bind ScheduleResource with asyn method ?

I m using the below syntax but it is nor working. Could you please correct me ?

 <ScheduleResources>
            <ScheduleResource TItem="ResourceData" TValue="int" DataSource="@RoomData()"
                              Field="Id" Title="Room" Name="Rooms"
                              TextField="RoomText" IdField="Id" AllowMultiple="false">

            </ScheduleResource>
        </ScheduleResources>
---------------------------------------------------------

 public  async Task<List<ResourceData>> RoomData()
    {
        var RoomData = new List<ResourceData>();
        RoomData = await ScheduleService.GetAllResourceData();
        return RoomData;
    }

1 Reply 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team February 16, 2021 04:12 PM UTC

Hi Chandradev, 
 
Greetings from Syncfusion Support. 
 
We have checked the reported problem in the shared code and let you know that you can assign the variable to resource DataSource  instead of directly assign the async method. Please try the below code snippet and for the same we have shared the sample which can be downloaded from the following link. 
    public List<ResourceData> ResourceData; 
    public async Task<List<ResourceData>> RoomData() 
    { 
        var RoomData = new List<ResourceData>(); 
        RoomData = await ScheduleService.GetResourceData(); 
        return RoomData; 
    } 
 
    protected async override Task OnInitializedAsync() 
    { 
        await base.OnInitializedAsync(); 
        ResourceData = await RoomData(); 
    } 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Nevitha 


Marked as answer
Loader.
Up arrow icon