私はC#でif条件を1つ持っています
if (item.ReporSubCategoryId == 1 || item.ReporSubCategoryId == 2 ||
item.ReporSubCategoryId == 3 || item.ReporSubCategoryId == 4)
{
<a href="@Url.Action("GetPdf", "Report", new { report = item.ReporSubCategoryId })" >@item.ReportTitle</a>
}
条件が変わったら三項演算子を使いたいのですが?
このタグの表示と非表示を使用する場合 ( style='display:Myconditions?block:None'
)
<a href="@Url.Action("GetPdf", "Report", new { report = item.ReporSubCategoryId })" >@item.ReportTitle</a>
しかし、私はこのコードを試します
<a style='display:" @item.ReporSubCategoryId == 1 || @item.ReporSubCategoryId == 2 || @item.ReporSubCategoryId == 3 || @item.ReporSubCategoryId == 4 ?block:None"'href="@Url.Action("GetPdf", "Report", new { report = item.ReporSubCategoryId })" >@item.ReportTitle</a>
しかし、それは機能していません。私の間違った正しい解決策を教えてください。