Reputation: 73
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>
Upvotes: 0
Views: 495
Reputation: 73
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" />
Upvotes: 0
Reputation: 1867
Assuming this is razor, add below to your input tag with type checkbox.
@Html.Raw(@item.File_Status == "IN"? "disabled" : "")
Upvotes: 1