fullstackhero / blazor-wasm-boilerplate

Clean Architecture Boilerplate Template for .NET 6.0 Blazor WebAssembly built for FSH WebAPI with the goodness of MudBlazor Components.

Home Page:https://fullstackhero.net/blazor-webassembly-boilerplate/general/getting-started/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access field by code

anasseb opened this issue · comments

Hello,
I have a little issue, I can't find how to access a field from code.
For exemple in the product form, I want to fill the field description when I'm clicking on a button.

I already did the method on click, but I don't know how to change the description value.
The context.Description is not accessible from Product.razor
Thanks.

You can access the request model via Context.AddEditModal.RequestModel. It's actually in the product form you can see how that's done (the image upload thing).

So for the description, you can set it by doing Context.AddEditModal.RequestModel.Description = "your description";
You have to call Context.AddEditModal.ForceRender() afterwards though... as the components aren't automatically updated in that direction.

You can access the request model via Context.AddEditModal.RequestModel. It's actually in the product form you can see how that's done (the image upload thing).

So for the description, you can set it by doing Context.AddEditModal.RequestModel.Description = "your description"; You have to call Context.AddEditModal.ForceRender() afterwards though... as the components aren't automatically updated in that direction.

Thank you for your time, it's absolutely what I'm looking for.