locked
Session Variable RRS feed

  • Question

  • User839249405 posted

    I want to use a UserName as Session Variable , When ever user name text box appears name should come automatically after two key strokes of name.

     

    thaks in advance

    Wednesday, March 7, 2012 1:36 AM

Answers

  • User2105670541 posted

    you can use the same on OnTextChanged event of your textbox, you just need to check the length of your textBox.Text.Length property and if it goes more then 2 characters in length you should retrieve the value from session like code below:

    protected void txtUserName_OnTextChanged(object sender, EventArgs e)
    {
    
    if(txtUserName.Text.Length>2)
    {
    txtUserName.Text=Convert.ToString(Session["UserName"]);
    }
    
    }
     
    where Session["UserName"] is the session you should have created earlier.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 7, 2012 2:04 AM

All replies