Open MadsCastle7 opened 3 weeks ago
Hello @MadsCastle7, Blazor until .NET 9 don't support constructor injection.
You can try using InjectAttribute.
Please send any info here if this is not what you meant.
the above didn't work . so instead of trying to use JJMasterdata directly in Blazor, i've created an API project and added a route in there. The code below successfully returns the form
I have then added an HttpPost route to try and save the contents, however GetFormValuesAsync() is always empty. I'm guessing that i need a handle to the form id? Can you offer any advice?
the above didn't work . so instead of trying to use JJMasterdata directly in Blazor, i've created an API project and added a route in there. The code below successfully returns the form
I have then added an HttpPost route to try and save the contents, however GetFormValuesAsync() is always empty. I'm guessing that i need a handle to the form id? Can you offer any advice?
Can you share the complete snippet of your .razor
or .cs
file so I can repro?
razor page
razor c#
You need to send the form values at your Post request, because without the form values the GetFormValuesAsync
will not know what to send to you I think.
How would i get the model populated in the PostAsync?
On another screen, I've amended the form returned and added some bind statements to it to bind it to a model , which then worked. But, how can I populate the model to send in the Post without manually changing the returned form?
I am trying to get a form displayed in a Blazor web site. I don't need a mobile version that you pointed out was a problem before. However, in Blazor I cannot instantiate the object in a constructor as Blazor will not allow this and gives an error when trying to add the class as a singleton in Program.cs
Is it therefore possible to do something like:
IComponentFactory c = new ComponentFactory();
As it stands it appears that the protection level on the class will not allow this.