KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am having issues with displaying (rather NOT displaying) plain text in an else block. if (Model.CareerFields != null && ViewBag.CFCount > 0) { <h3>Careerfields Listing</h3> <table> <tr> <th></th> <th>Careerfield Name</th> </tr> @foreach (var item in Model.CareerFields) { <tr> <td> @Html.ActionLink("Select", "Index", new { careerFieldID = item.CareerFieldId }) </td> <td> @item.CareerFieldName </td> </tr> } </table> } else { No Careerfields associated with @ViewBag.SelectedDivisionTitle } The if blocks works fine. The text only renders when true. However, the else block text renders when the page loads, not if it evaluates to false only. I've tried using Hmtl.Raw("No Careerfields associated with ") <text>No Careerfields associated with @ViewBag.SelectedDivisionTitle</text> @:No Careerfields associated with @ViewBag.SelectedDivisionTitle But it still renders the plaintext before evaluation. Any suggestions?
Tags (comma-separated)
Save Edits
Cancel