i try to when user login with thier name and passowrd then theri name is visible just like facebook.. please have a look this image
here is the code
<div class="mainmenu"> <div id="mainmenu"> <ul class="sf-menu"> <li><a href="Home.aspx" id="visited"><span class="home"><img src="images/home.png" alt="" /></span>Home</a></li> <li><a href=""><span class="home"><img src="images/about.png" alt="" /></span>About</a></li> <li><a href=""><span class="home"><img src="images/portfolio.png" alt="" /></span>Portfolio</a> <ul> <li><a href="gallery.aspx">Portfolio Gallery</a></li> </ul> </li> <%-- <li><a href=""><span class="home"><img src="images/blog.png" alt="" /></span>Reports</a> <ul> <asp:Panel ID="Panel1" runat="server"> <li><a href="Reportss.aspx">Submit Reports</a></li> <li><a href="View_Reports.aspx">View Reports</a></li></asp:Panel> </ul> </li>--%> <li><a href=""><span class="home"><img src="images/features.png" alt="" /></span>features</a></li> <li><a href="contact.aspx"><span class="home"><img src="images/contact.png" alt="" /></span>Contact</a></li> <li><a href="Login1.aspx"><span class="home"><img src="images/contact.png" alt="" /></span>LOGIN</a></li> <li><div class="loginname"><asp:Label ID="WELCOME" Font-Size="X-Large" runat="server" Text="" ></asp:Label></div><li> <li> <asp:LinkButton ID="lbtnLogout" Text="Logout" runat="server" CausesValidation="false" OnClick="lbtnLogout_Click" Font-Bold="True" ForeColor="Red"></asp:LinkButton><li> </ul> </div> </div>
code
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["UName"] != null) { WELCOME.Text = Session["UName"].ToString() + ")"; } lbtnLogout.Visible = Session["UName"] != null; } } protected void lbtnLogout_Click(object sender, EventArgs e) { Session.Abandon(); Session.Clear(); Response.Redirect("Login1.aspx"); }
Hi Bakhtawar,
For your issue ,I suggest that you can add logical code to your menu.
You can verify the user whether has logged in the system.
Here is the code snippet:
<ul class="nav navbar-nav"> <% if (Session["UName"] != null) {%> <li> <ul> <li><a runat="server" href="~/">Logout</a></li> <li><a runat="server" href="~/">Session["UName"]</a></li> </ul> </li> <%} else{ %> <li><a runat="server" href="~/Login">Login</a></li> <%} %> </ul>
Best Regards,
Kevin Shen.
Hi,
Seems ur menu is driven by: <li><a>
so if u want name be display along menu items,
then u have to follow the same structure, but not <li><div>.
Hi can you share the css . I want to check what css property are there in the class.