how to lostfocus Event in textbox asp.net RRS feed

  • Question

  • User1827380138 posted

    Id = txtbox1

    name= txtbox2


    city= txtbox4

    when i Enter Id and change the focus txtbox1 to txtbox2  details preloaded in text boxes ; Which event to write code for this method

    Friday, January 3, 2020 1:08 PM

All replies

  • User281315223 posted

    It's likely that you'll want to wire up an event handler for your ID Textbox that will trigger when the text is changed:

    <asp:TextBox ID="txtBox1" runat="server" AutoPostBack="true" OnTextChanged="txtBox1_TextChanged" />

    Then, you'll just define the corresponding code-behind to perform your preloading:

    protected void txtBox1_TextChanged(object sender, EventArgs e)
          // Read your ID
          var id = txtBox1.Text;
          // Populate your values here 
          name.Text = "...";
          mob.Text = "...";
          city.Text = "...";

    Friday, January 3, 2020 3:33 PM