Question

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>
Was it helpful?

Solution

Check out asp:label width - is this a bug?

It suggests using CSS to solve the same problem you're having.

OTHER TIPS

Just make label float left.

<label id="pwd">Password:</label>

The Css:

#pwd {
     float:left;    // This will make the width works.
     width:100px;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top