I’m building a form in ASP.NET to send an email. So far things work great and I’m able to pass my ASP:TextBox contents to the email without any issue. Right now how I’ve done things is put in static text as the TB label and then follow it up with a TB control for the input.
Should I be using the ASP:Label control instead?
Code example:
<div>
Pub Contact Phone: <asp:TextBox ID="PublicationContactPhone" runat="server" TabIndex="9"></asp:TextBox>
</div>
Is there a form best practice that says to have all the non-input text as labels or is it preference?
This sounds like maybe a mixup of the ASP.NET
<asp:Label>control and the HTML<label>element. For building forms it’s a good practice to use the HTML<label>for an input label so that clicking on the label will give the input element focus, you can implement a label two ways:<label>A TextBox <input id="txtbox1" type="text" /></label>)forattribute on the label to theidof the input (ex.<label for="txtbox1">A TextBox</label> <input id="txtbox1" type="text" />)So you can markup your page like so and the text
Pub Contact Phone:will be clickable to give focus to the input