New-UDGrid not invoked as part of -OnChange endpoint

Hi,

I have a simple page that allows a drop down seletion of options - when an option is selected, i want to show the corresponding csv file in a grid.

The toast is shown on screen but nothing after that at all - any thoughts on how to resolve please?

$Page3 = New-UDPage -Name “Page3” -Icon Users -Endpoint {
$CSVFilePath = “”
$O365LicenseByUsers = “”
New-UDSelect -Id “Page3” -Label “License Choice” -Option {
New-UDSelectOption -Name “License 1” -Value “License 1” -Selected
New-UDSelectOption -Name “License 2” -Value “License 2”
} -OnChange {
$CSVFilePath = “C:\Dashboards-Data\AuditData\O365Option1.csv”
$O365LicenseByUsers = ( Import-Csv $CSVFilePath | Select “DisplayName”,“UserPrincipalName”,“JobTitle”,“Department”,“UsageLocation” | Sort-Object UserPrincipalName )
Show-UDToast -Message “You have Selected: $EventData” -Duration 2000 -Position bottomLeft -BackgroundColor red -MessageColor white
New-UDGrid -Id “Page3” -Title “Page3-Licenses” -PageSize 20 -Headers @(“DisplayName”,“UserPrincipalName”,“JobTitle”,“Department”,“UsageLocation”) -Properties @(“DisplayName”,“UserPrincipalName”,“JobTitle”,“Department”,“UsageLocation”) -Endpoint {
Import-Csv $CSVFilePath | Select “DisplayName”,“UserPrincipalName”,“JobTitle”,“Department”,“UsageLocation” | Sort-Object UserPrincipalName | Out-UDGridData
}
}
$O365LicenseByUsers | Out-UDGridData
}