In flowlayout I thought that you used the <center> tag to center things like labels, but I have found out that is not the case. What tag would you use? Or how to you center your elements like labels in flow layout?
An asp:label control is rendered as a span tag in html. Span tags don't take up the full screen/page width so you can't center them with their default behavior. There are several ways you could approach this - here's one (that works in IE - I can't speak for other browsers and how they might interprest these styles).
Add two styles to your label control - one to give it a width, and one to align its text. For example - to center align an asp:label named 'lblTest':
Code:
// C# Example that's be almost identical (minus the semi-colons) in VB.Net:
lblTest.Style.Add("width", "100%");
lblTest.Style.Add("text-align", "center");
The above is how you'd do it in code behind. If you wanted to do the centering in your aspx then add a style attribute to your asp:label control tag (in html view) that looks like this:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.