0

I want to disable select checkbox in the row conditionally. If the File_Status is "IN", the checkbox select must be Enabled else Disabled. How can i achieve this using jquery. Stuck, Need help

<table id="Infiletbl" class="table table-responsive table-hover">
                    <tr>
                        <th>Select</th>
                        <th>Dept_Code</th>
                        <th>File_Code</th>
                        <th>Carton_Code</th>
                        <th>File_Status</th>
                        <th>Dept_File_ID</th>


                    </tr>
                    <tbody>
                        @if (ViewBag.Infilelist != null)
                    {
                        foreach (var item in ViewBag.Infilelist)
                        {
                    <tr>
                        <td><input id="reqflchk" name="filerequestfc" type="checkbox" class="chkCheckBoxId" value="@item.FileIN_ID"  /></td>
@Html.Raw(@item.File_Status == "IN" ? "disabled" : "")


                        <td>@item.Dept_Code</td>
                        <td>@item.File_Code</td>
                        <td>@item.Carton_Code</td>
                        <td>@item.File_Status</td>
                        <td>@item.Dept_File_ID</td>



                    </tr>


                        }
                    }
                    </tbody>

                </table>

2 Answers 2

1

Assuming this is razor, add below to your input tag with type checkbox.

@Html.Raw(@item.File_Status == "IN"? "disabled" : "")

Sign up to request clarification or add additional context in comments.

Comments

0

was able to disable the checkboxes with the following code

<input id="reqflchk" type="checkbox" @(item.File_Status != "Retrieval-Processed" ? " disabled='disabled'" : null) value="@item.FileIN_ID" name="filerequestfc" hidden="hidden" checked="checked" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.