2

In an ASP.NET MVC project I would like to display a brief message to the user, eg. 'Hello, username!'

i the navigational bar, if the user is signed in. I'm using the standard bootstrap layout, and trying this, but it appears weirdly. I'm not sure what CSS ot HTML to change. Here's what I'm trying.

 @if (Session["Username"] != null)
            {
                <ul class="nav navbar-nav navbar-right">
                    <li>Hello, @Session["Username"]</li>
                    <li>@Html.ActionLink("Logout", "Logout", "Home")</li>
                </ul>
            }
            else
            {
                <ul class="nav navbar-nav navbar-right">
                    <li>@Html.ActionLink("Register", "Register", "Home")</li>
                </ul>
            }

That's in my _Layout page. The right text appears, but it's kind of off-centre and dark, not easily visible. How can I make it appear just like the actionlinks?

Jordan Andrews
  • 163
  • 3
  • 16
  • You can use firebug of mozila to change the css. You can use this [link](http://getfirebug.com/css) and another [link](http://stackoverflow.com/questions/162644/why-cant-i-save-css-changes-in-firebug) – शेखर Oct 06 '14 at 06:39
  • You can add style to your username like
  • Hello @Session["Username"]
  • – M.Azad Oct 06 '14 at 06:41
  • Use your browser tools to inspect the css for the link, create a class with similar properties, then render the message in an element with that class name –  Oct 06 '14 at 06:58