Why Label Width does not work inside ChangePassword control ? asp.net
-
14-07-2021 - |
Pregunta
I have a ChangePassword
control and I converted it to a template. I removed all of the table code and tried to format everything myself. When I set the Width
property of the Label
control, I found it does not work. Can anyone see what I might be doing wrong?
Code Sample (stripped down):
<asp:ChangePassword ID="ChangePassword1" runat="server">
<ChangePasswordTemplate>
<asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword" Width="250">Password:</asp:Label>
<asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</ChangePasswordTemplate>
</asp:ChangePassword>
Solución
Check out asp:label width - is this a bug?
It suggests using CSS
to solve the same problem you're having.
Otros consejos
Just make label
float left.
<label id="pwd">Password:</label>
The Css:
#pwd {
float:left; // This will make the width works.
width:100px;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow