How to auto generate the name of the user who is logged in?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ivyG
    New Member
    • Nov 2010
    • 3

    #1

    How to auto generate the name of the user who is logged in?

    How do you auto generate the name of the user who is logged in?

    For example,
    I had a Detail View to allow the user to insert the data, and i have a column named "Teacher In Charge 1".
    I wish to grab the name from another table called "Teacher".. .
    _______________ ____________

    Table :
    - NRIC
    - Teacher-In-Charge1
    - CIP Event
    - Hours
    - etc...

    Teacher Table :
    - NRIC
    - Name
    - Gender
    - Class
    - Course
    _______________ _________
    - The user used its NRIC to log on to the web site.
    Other than using the code below to auto generate the name,
    Code:
    protected void DetailsView1_DataBound(object sender, EventArgs e)
    {
       TextBox txtBox = (TextBox)this.DetailsView1.FindControl("TextBox1");
       txtBox.Text = User.Identity.Name.ToString();
    }
    [imgnothumb]http://bytes.com/attachments/attachment/4245d1290761711/1.jpg[/imgnothumb]
    Attached Files
    Last edited by Frinavale; Nov 26 '10, 02:34 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags, added the image into the thread, and also added the question into the body of the thread
Working...