Select drop-down fields, where am I supposed to store data meant for input for said fields? RRS feed

  • Question

  • User-1619399849 posted

    I am fairly new to Blazor, and was wondering what would be best practice when it comes to select drop-down fields. This doesn't feel right to me:

    <InputSelect class="form-control" id="PWIO" @bind-Value="@newInjury.LAWIModel.PlaceWhereInjuryOccured" @onkeyup="@(() => {HideUnhideField("PlaceWhereInjuryOccured");})" @onclick="@(() => {HideUnhideField("PlaceWhereInjuryOccured");})">
                    <option value="">Select Mechanism of Injury...</option>
                    <option value="Overuse">Overuse</option>
                    <option value="Struck by or collision with another playeror object">Struck by or collision with another playeror object</option>
                    <option value="Collision with fixed object/equipment">Collision with fixed object/equipment </option>
                    <option value="fall/slip/trip/ stumble on same level">fall/ slip/trip/ stumble on same level</option>
                    <option value="Sudden or rapid acceleration and deceleration">Sudden or rapid acceleration and deceleration</option>
                    <option value="Jumping, including landing from jump">Jumping, including landing from jump</option>
                    <option value="Temperature related">Temperature related</option>
                    <option value="Other">Other</option>
                    <option value="Unknown">Unknown</option>

    I was wondering if storing input data for select drop down fields in @code section of the page would be the most appropriate approach. I would appreciate any pointers or recommendations. Thank you

    Wednesday, December 30, 2020 11:02 AM


  • User379720387 posted

    Perfectly fine for testing.

    One step up would be to use Enums to populate your select more here

    After that you next step would be to put this information in a database and use it to populate the select.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 30, 2020 4:30 PM