By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Question: TextBox - Can't Align Center

P: n/a
I cant 'align center' a text box.

First of all, all the justifications (left, center, right) on the toolbar
are dimmed. Why?

Also, when I try to do it through HTML (wrapping the control in a <p
align="center"><asp:TextBox ...></p>) this doesn't work either.

Any ideas?

Thanks.
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Do you want the text in the text box to be centered in the textbox? If so I
don't think HTML supports this.
<P align="center"><asp:TextBox id="TextBox1"
runat="server"></asp:TextBox></P>

This works for me.

Perhaps other areas on the page are throwing off the alignment?
"VB Programmer" <gr*********@go-intech.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
I cant 'align center' a text box.

First of all, all the justifications (left, center, right) on the toolbar
are dimmed. Why?

Also, when I try to do it through HTML (wrapping the control in a <p
align="center"><asp:TextBox ...></p>) this doesn't work either.

Any ideas?

Thanks.

Nov 17 '05 #2

P: n/a
You can either give your textbox a CSS class:

// Class Method
..MyTextBox {
text-align: center;
}

Alternatively, you could simply apply the following style to the textbox:

MyTextBox.Attributes.Add("style","text-align: center")

--
Tony Williams
www.bigtone.net

"Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
Do you want the text in the text box to be centered in the textbox? If so I don't think HTML supports this.
<P align="center"><asp:TextBox id="TextBox1"
runat="server"></asp:TextBox></P>

This works for me.

Perhaps other areas on the page are throwing off the alignment?
"VB Programmer" <gr*********@go-intech.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
I cant 'align center' a text box.

First of all, all the justifications (left, center, right) on the toolbar are dimmed. Why?

Also, when I try to do it through HTML (wrapping the control in a <p
align="center"><asp:TextBox ...></p>) this doesn't work either.

Any ideas?

Thanks.


Nov 17 '05 #3

P: n/a
I just highlight it like you would to a paragraph in MS word, the buttons
will become undimmed.
"VB Programmer" <gr*********@go-intech.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
I cant 'align center' a text box.

First of all, all the justifications (left, center, right) on the toolbar
are dimmed. Why?

Also, when I try to do it through HTML (wrapping the control in a <p
align="center"><asp:TextBox ...></p>) this doesn't work either.

Any ideas?

Thanks.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.