Skip to content

Commit

Permalink
Set either EditContext or Model on BSForms
Browse files Browse the repository at this point in the history
  • Loading branch information
jespersh committed Oct 12, 2020
1 parent 0e9255a commit 5863bf1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/BlazorStrap/Components/Forms/BSForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
Formbuilder.OpenComponent<EditForm>(0);
Formbuilder.AddMultipleAttributes(1, AdditionalAttributes);
Formbuilder.AddAttribute(2, "class", Classname);
Formbuilder.AddAttribute(3, "Model", Model);
Formbuilder.AddAttribute(4, "EditContext", EditContext);
Formbuilder.AddAttribute(5, "OnSubmit", OnSubmit);
Formbuilder.AddAttribute(6, "OnValidSubmit", OnValidSubmit);
Formbuilder.AddAttribute(7, "OnInvalidSubmit", OnInvalidSubmit);
Formbuilder.AddAttribute(8, "ChildContent", ChildContent);
if (EditContext != null)
{
Formbuilder.AddAttribute(3, "EditContext", EditContext);
}
else
{
Formbuilder.AddAttribute(3, "Model", Model);
}
Formbuilder.AddAttribute(4, "OnSubmit", OnSubmit);
Formbuilder.AddAttribute(5, "OnValidSubmit", OnValidSubmit);
Formbuilder.AddAttribute(6, "OnInvalidSubmit", OnInvalidSubmit);
Formbuilder.AddAttribute(7, "ChildContent", ChildContent);
Formbuilder.CloseComponent();
};

Expand Down

0 comments on commit 5863bf1

Please sign in to comment.