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 callContext.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.