saberune
❔ Razor Page - Select Tag Helper (form-select): Need help with onchange event for drop-down list
In my APR.cshtml page I have the following drop down list present:
<select asp-for="@Model.ServerName" class="form-select" onchange="Model.ChangeServer()">
The drop down-list works fine but I cannot find the right syntax for the onchange element. I've tried different variations of what's depicted above but non seem to work. For context, in the associated model page (APR.cshtml.cs) I have a function called ChangeServer which I want to change the values of a different drop-down list in my form when a different selection is made for the drop-down list above.
Any guidance would be greatly appreciated. I feel like I'm missing something significant and I've googled a lot but haven't found the right resource 😦18 replies
❔ Catching more detailed errors for PowerShell in C# web application (.Net6)
I have a snippet of code here that does catch generic errors fine but I am having a hard time troubleshooting without more details about the error.
The following helps catch the general error. I am wondering if anyone knows how to improve it so it can catch the full error:
...
note:
-ps is type Powershell
- errorMsg is type string
ps.Streams.Error.DataAdded += (object sender, DataAddedEventArgs e) =>
{
errorMsg = ((PSDataCollection<ErrorRecord>)sender)[e.Index].ToString();
};
Thanks in advance!6 replies