79749909

Date: 2025-08-29 06:55:22
Score: 0.5
Natty:
Report link

Add the @rendermode directive

@inject NavigationManager Navigation

@rendermode InteractiveServer

<EditForm Model="@searchModel" OnValidSubmit="Submit" FormName="BookingForm" class="book_now">
    <ValidationSummary />
    <div class="row">
        <div class="col-md-12">
            <span>Arrival</span>
            <img class="date_cua" src="/template/images/date.png">
            <InputDate class="online_book" @bind-Value="searchModel.CheckIn" />
            <div class="mb-3">Entered date: @searchModel.CheckIn</div>
        </div>
        <div class="col-md-12">
            <span>Departure</span>
            <img class="date_cua" src="/template/images/date.png">
            <InputDate class="online_book" @bind-Value="searchModel.CheckOut" />
            <div class="mb-3">Entered date: @searchModel.CheckOut</div>
        </div>
        <div class="col-md-12">
            <button type="submit" class="book_btn">Book Now</button>
        </div>
    </div>
</EditForm>

Without the @rendermode directive the page is rendered statically (SSR only), so the model won’t be updated on submit.

By adding @rendermode InteractiveServer (or another interactive mode), the binding works as expected.

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @rendermode
  • Low reputation (1):
Posted by: Giorgio Todeschini