shtml how to test string empty

122 Views Asked by At

I have a piece of shtml to amend:

@foreach (Dictionary.DictionaryItem item in countriesParentNode.Children.OrderBy(d => d.Value(languageId)))
{ 
        string itmval = @item.Value(languageId);
        bool empty = @itmval == "";
  <option value="@item.key.ToString().Replace(rootKeyToReplace, "")">@item.Value(languageId) @empty</option>
}

I need to display < option... > bit only if value is not empty (bool empty is false).

I tried

if (notEmpty) {}
@if (notEmpty) {}
if (@notEmpty) {}
@if (@notEmpty) {}

All return errors. How to do it then?

I cannot find out anywhere any example, only some SSI include examples

0

There are 0 best solutions below