The next code shows how you can attach an asp:Label control with the asp:TextBox. In this case when the user clicks the Label the application will focus on the TextBox.



<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TestAssociate.aspx.vb” Inherits=”TextChange.TestAssociate” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

<html xmlns=””>

<head runat=”server”>

<title>Associate a Label with a TextBox</title>



<form id=”form1″ runat=”server”>


<asp:Label ID=”LabelEMail” runat=”server” Text=”E-Mail: ” AssociatedControlID=”TextEMail”></asp:Label>

<asp:TextBox ID=”TextEMail” runat=”server”></asp:TextBox>





You can associate the Label to the TextBox control by specifying the Label property AssociateControlID to the TextBox’s ID. Clicking on the Label control focuses the TextBox.