如果在Razor中用于两个不同的列
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如果在Razor中用于两个不同的列相关的知识,希望对你有一定的参考价值。
所以我的表中有两列。被锁定和更改待定。当Is Locked处于活动状态时,编辑将被禁用。但是在其他如此解锁和更改等待您可以在操作菜单中访问编辑。
到目前为止,我已经锁定了工作,但在其他方面,编辑仍然被禁用。
<td class="hidden-xs hidden-sm text-center">
@if (t.IsLocked)
{
//<span class="fa fa-lock fa-lg writer-locked" data-toggle="tooltip" title="This song is locked, pending changes."></span>
}
else
{
//<span class="fa fa-lock fa-lg writer-locked" data-toggle="tooltip" title="This song is locked, pending changes."></span>
<span class="fa fa-unlock fa-lg writer-unlocked" data-toggle="tooltip" title="This song is unlocked, there are no pending changes." aria-hidden="true"></span>
}
</td>
<td class="hidden-xs hidden-sm text-center">
@if (t.HasActiveAmendment)
{
//<span class="fa fa-pencil-square-o writers-cross text-center" aria-hidden="true" data-toggle="tooltip" title="This song has been edited, pending changes."></span>
}
else
{
//<span class="fa fa-pencil-square-o writers-cross text-center" aria-hidden="true" data-toggle="tooltip" title="This song has been edited, pending changes."></span>
<span class="fa fa-minus writers-check text-center" data-toggle="tooltip" title="This song has no pending changes." aria-hidden="true"></span>
}
</td>
<td class="updateTableRow text-center">
<div class="dropdownContainer btn-group text-right">
<button id="@actionWriterId" type="button" class="btn btn-primary br2 btn-xs fs12 dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Action
<span class="caret ml5"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li>
@if (t.IsLocked)
{
<a href="#" id="@editWriterId" data-container="body" data-toggle="tooltip" title="Edit" data-rowhover="editTableRow" class="js_EditWriter">Edit</a>
}
else
{
<a class="isDisabled" data-toggle="tooltip" title="You cannot edit this song until pending writer edits are approved">Edit</a>
}
</li>
<li>
<a href="#" id="@deleteWriterId" data-container="body" data-toggle="tooltip" title="Delete" data-rowhover="deleteTableRow" class="js_DeleteWriter">Delete</a>
</li>
</ul>
</div>
</td>
</tr>
tableRowIndex++;
}
</tbody>
</table>
答案
我想你是说你想要仅在IsLocked时禁用编辑 - 看起来你只是错误地使用if语句,所以我会尝试改变
@if (t.IsLocked)
{
<a href="#" id="@editWriterId" data-container="body" data-toggle="tooltip" title="Edit" data-rowhover="editTableRow" class="js_EditWriter">Edit</a>
}
else
{
<a class="isDisabled" data-toggle="tooltip" title="You cannot edit this song until pending writer edits are approved">Edit</a>
}
至
@if (t.IsLocked)
{
<a class="isDisabled" data-toggle="tooltip" title="You cannot edit this song until pending writer edits are approved">Edit</a>
}
else
{
<a href="#" id="@editWriterId" data-container="body" data-toggle="tooltip" title="Edit" data-rowhover="editTableRow" class="js_EditWriter">Edit</a>
}
例如。
- 如果锁定,则无法编辑为已禁用;
- 否则,可以编辑
以上是关于如果在Razor中用于两个不同的列的主要内容,如果未能解决你的问题,请参考以下文章
如果在同一位置有两个具有两种不同颜色的顶点,片段会得到啥颜色?