-3

My idea is when the user logs in the "login" and "register" will no longer be seen and instead it will show the user name first name on the navbar.

Markup:

<ul class="nav navbar-nav">
  <li>
    <a href="#">Register<span class="glyphicon glyphicon-user"</span></a>
   </li>
   <li id="LoginBTN">
     <a href="#">Log in<span class="glyphicon glyphicon-log-in"></span></a>
   </li>
</ul>

Code behind:

protected void BTNLogIn_Click(object sender, ImageClickEventArgs e)
{
    SqlMyName SqlUser= new SqlMyName ();
    DataSet DsUser = new DataSet();
    string StUser = "SELECT TblUsers.User_Name, TblUsers.Pass FROM TblUsers WHERE (((TblUsers.User_Name)= '" + TXTUserName.Text + "') AND ((TblUsers.Pass)= '" + TXTPass.Text + "'));";
    DsUser = SqlUser.chkData(StUser);
    if (DsUser.Tables[0].Rows.Count > 0)
    {
        string StShowFname = "SELECT TblUsers.Fname FROM TblUsers WHERE (((TblUsers.User_Name)= '" + TXTUserName.Text + "'));"; 
        DataSet DsShowFname = SqlUser.chkData(StShowFname);

        //How can I unshow or change text of <li>?
     } 
} 

What should I do in the code behind?

mason
  • 31,774
  • 10
  • 77
  • 121
harel486
  • 183
  • 1
  • 1
  • 13
  • 1
    Yes, you can. That answers your question, right? So what's your real question? Have you done any research to see how one can tell if the user is logged in from a code behind, or how one can interact with the DOM from code behind? – mason May 07 '16 at 13:49
  • @mason My question is how can I do it with the code behind. I know how to check if the user loged in, but then what do I do? How do I change the text or making one of the
  • disapper?
  • – harel486 May 07 '16 at 13:53
  • Please edit the question so that it shows the actual question being asked and show how you are checking to make sure if a user is logged in with code behind. This makes your question clear and isolates the specific part that you want to learn about. While your at it, fix the title: there's no such thing as "bootsrap" and your title should accurately reflect your issue, not just state what technology you're using. – mason May 07 '16 at 14:10