why are the first characters in my asp login labels in italics?
题
I can't work out why the first characters of all the labels on my asp login forms are showing in italics:
The code looks like this:
<asp:login DestinationPageUrl="blah.aspx" runat="server" usernamelabeltext="Email Address" ></asp:login>
When I inspect it using firebug it shows that the first characters are being enclosed in tags, like so:
<label for="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_wwContentArea_ctl03_UserName">
<em>E</em>
mail Address
</label>
...
<label for="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_wwContentArea_ctl03_Password">
<em>P</em>
assword:
</label>
Does anyone know what may be causing this? I thought it might have been something to do with access keys (if I press alt+e then it focuses to the email text box) but I cant work out how to stop this.
解决方案 2
I can't answer why it was doing it, but I've managed to work around it.
With the line of code still as follows:
<asp:login DestinationPageUrl="/schools/what-works/whatworkssearch.aspx" runat="server" usernamelabeltext="Email Address"></asp:login>
This is what the control looked like in designer view:
Although there are no italics shown, it was being rendered with the first characters in italics as I described in my question. To get around this I converted the control to a template like so:
This created a template that shows the labels for the login fields and therefore I could remove the italics tags.
Although this doesn't answer why it was behaving like this for the single line of code, it shows how to get around it.
其他提示
For me, it was because I was using the CSS Friendly Control Adapters. Since my primary motivation for installing them was for the menu control adapter, I've disabled the login control adapter.
- Open the CSSFriendAdapters.browser in the App_Browsers folder.
Comment out the LoginAdapter, like so:
<!--<adapter controlType="System.Web.UI.WebControls.Login" adapterType="CSSFriendly.LoginAdapter" />-->
There's probably a way to get the advantages of the CSS adapter without the italics.
You may want to check the AccessKey property of the login control and the individual controls pasted within the login section such as Label, TextBox and buttons. By removing the AccessKey value should fix the issue.