How to declare a local variable in Razor?

I think you were pretty close, try this:

@{bool isUserConnected = string.IsNullOrEmpty(Model.CreatorFullName);}
@if (isUserConnected)
{ // meaning that the viewing user has not been saved so continue
    <div>
        <div> click to join us </div>
        <a id="login" href="https://stackoverflow.com/questions/6601715/javascript:void(0);" style="display: inline; ">join here</a>
    </div>
}

Leave a Comment