mardi 6 septembre 2022

Saving which radio button has been checked

I have a list of three radio buttons and I'm trying to figure out how I can display which one has been clicked and saved. These radio buttons are in my Blazor project and the UpdateFilter method on the on click just saves the string to the database. How can I make the one that is clicked and saved show as checked when the page is loaded?

        <label class="GroupTitle">Filters:</label><br/>
        <input type="radio" name="number" id="all" @oninput="@(() => UpdateFilter("all"))" /> 
        <label for="">Clear all files</label><br />  
        <input type="radio" name="number" id="number" @oninput="@(() => UpdateFilter("number"))" />
        <label for="">Based on number of files</label><br />    
        <input type="radio" name="number" id="date" @oninput="@(() => UpdateFilter("date"))" />    
        <label for="date">Based on date of files</label><br />



Aucun commentaire:

Enregistrer un commentaire