saberune
❔ Razor Page - Select Tag Helper (form-select): Need help with onchange event for drop-down list
Yes, but can the handler for a different form interact with the property sent from the first form? Or do you mean that each form's handler can only access the data passed by its own form?
18 replies
❔ Razor Page - Select Tag Helper (form-select): Need help with onchange event for drop-down list
@Angius So I tried using 2 separate forms one for each drop down list. The first form is basically the drop down list for server selection. I used the javascript call to submit the first form. The @Model.ServerName binds the value to the ServerName property in the .cshtml.cs, however my second form which processes that property when submitted now gives me a NullReferenceException when I try to use that property.
My question is, do the properties in my models page only persist for each individual form? I'm just confused because it was working fine when everything was in one form.
Thank you in advance for your advice!
18 replies
❔ Razor Page - Select Tag Helper (form-select): Need help with onchange event for drop-down list
Yea it's Razor Pages with .cshtml and .cshtml.cs files.
The app is not MVC, it's just those two pages. I thought I could just call a function from the .cshtml.cs for the on change 😦
I guess a potential solution could be putting the drop-down list that I want to do on change for in a separate form so it can be submitted by itself when the on change happens? Is that possible?
18 replies
❔ Catching more detailed errors for PowerShell in C# web application (.Net6)
Ahhh amazing thank you so much that really helped.
I added the .exception property and now I'm able to see the inner stack trace.
errorMsg = ((PSDataCollection<ErrorRecord>)sender)[e.Index].Exception.ToString();
6 replies
❔ Catching more detailed errors for PowerShell in C# web application (.Net6)
@jcotton42 like if I just used this?
errorMsg = ((PSDataCollection<ErrorRecord>)sender)[e.Index]
I won't be able to output the error as string without stringification right? Unless you're thinking of a different way to capture the full error.
I'll get an error like: "An error has occurred which Windows PowerShell cannot handle." ---which is too vague for me to troubleshoot. Since the web app is invoking a powershell instance, there's no way for me to see the error.
Thanks again for your help.
6 replies