Label server control in ASP.NET 2.0 has a new attribute by name "AccessKey". Hotkeys are assigned using this keyword. As you know if we want to access an hot key we would use ALT + "access key".
Label server control also has another new attribute by name "AssociatedControlId". Here we would specify the name of another control on this form where control needs to go on using the hotkeys set.
For instance,
Write the below code snippet in your aspx and run the app. On clicking "ALT + N" the focus would be set on the TextBox control.
<asp:Label
ID="LblSample"
Runat="server"
AccessKey="N" AssociatedControlId="txtFirstname">First<u>n</u>ame
</asp:Label>
<asp:Textbox ID="txtFirstname" Runat="server"></asp:Textbox>
Label server control also has another new attribute by name "AssociatedControlId". Here we would specify the name of another control on this form where control needs to go on using the hotkeys set.
For instance,
Write the below code snippet in your aspx and run the app. On clicking "ALT + N" the focus would be set on the TextBox control.
<asp:Label
ID="LblSample"
Runat="server"
AccessKey="N" AssociatedControlId="txtFirstname">First<u>n</u>ame
</asp:Label>
<asp:Textbox ID="txtFirstname" Runat="server"></asp:Textbox>
Comments