Dear
can i add multiple edit model with Different model on same rezor page
ex:
Dear
can i add multiple edit model with Different model on same rezor page
ex:
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Uday DodiyaRank #239 · 10.3K reputationPosted Jan 8, 2023, 11:06 PM EST
Yes, it is possible to add multiple edit models on the same Razor page in a Blazor Server application.
To do this, you can define multiple forms on the page, each with its own edit model and associated form elements. You can then bind each form to its own edit model and handle the form submission separately in your code.
For example, let's say you have two models,
Model1andModel2, that you want to edit on the same page. You could define your page like this:@page "/edit" Submit Submit @code { Model1 Model1 { get; set; } Model2 Model2 { get; set; } async Task SubmitModel1() { // Save Model1 } async Task SubmitModel2() { // Save Model2 } }This will create two separate forms on the page, each with its own edit model and submit button. You can then handle the form submission separately in your code using the
SubmitModel1andSubmitModel2methods.ahmad abukhalil141 reputationPosted Jan 10, 2023, 9:20 AM EST
Thank you Uday Dodiya