I am setting up a select option values based on the value in the if condition. Is there a way to shorten then if condition and have it in one line?
<code>if (listValue == @Html.GetResourceString("ALL"))
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}
else
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}
</code>
<code>if (listValue == @Html.GetResourceString("ALL"))
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}
else
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}
</code>
if (listValue == @Html.GetResourceString("ALL"))
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}
else
{
<option value="@listValue" @(listValue == Model.Value ? "selected=selected" : "" )>@listValue</option>
}