AutoQuery Crud - Setting a parameter for the New Form

Without creating a custom form which makes this a little less useful, is there a way to set a property on the create autoform. I want to set SomeId on the CreateEmployeeDependent because it comes from a page parameter.

<AutoCreateForm Model="EmployeeDependent" ApiType="typeof(CreateEmployeeDependent)" />

public class CreateEmployeeDependent {
    public int SomeId {get;set;}   // <- I want to set this on create b/c it comes from a page parameter

public class EmployeeDependent {
  public int Id {get;set;}
  public int SomeId {get;set;}

You’d need to inherit the AutoCreateForm component and override the OnParametersSetAsync() method to populate the ModelDictionary that the form binds to.

1 Like

Thanks! Like the ConfigureQuery it would be nice to have access to these api calls before the execute without having override.

ConfigureCreate, ConfigureEdit etc

Just noticed AutoCreateForm has NewModel which you can use to prepopulate the model used.