lundi 30 novembre 2020

how to bind the list of checkbox value and according to the condition that checkbox should be checked and fill a color in the label in Blazor

This is one group of Checkbox that i'm checking and trying to list.

<div id="ee">

                                    @if ((listordermodel) != null)
                                    {
                                        @foreach (var item in listordermodel)
                                        {
                                            <tr>
                                                <th>Order</th>
                                                <td>
                                                    @if (@item.OrderStatusGroupID == 100) //Have OrderStatusGroupID==200 ,then 300
                                                    {
                                                        <h3>Order</h3>
                                                        @if (@item.StatusTime != null)

                                                        {
                                                            <ul>
                                                                <li>
                                                                    <input type="checkbox" id="@item.OrderStatusID" @bind="@Checked" />
                                                                    <label class="checkbox-label" for="@item.OrderStatusID"> @item.OrderStatusType</label>
                                                                </li>
                                                            </ul>
                                                        }

                                                        else
                                                        {
                                                         <ul>
                                                          <li>
                                                             <input type="checkbox" id="@item.OrderStatusID" @bind="@item.OrderStatusType" disabled="disabled" />
        <label class="checkbox-label" for="@item.OrderStatusID"> @item.OrderStatusType</label>
    </li>
</ul>

                                                        }
                                                    }
                                                    }
                                                </td>
                                    <td></td>
                                    </tr>
@code
{ 
private bool Checked = false;
}

i'm having trouble bind the checkbox value as checked and i fill the group color that im taking from the database that i have already set .




Aucun commentaire:

Enregistrer un commentaire