Question: TextBox - Can't Align Center

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

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.
 
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?
 
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")
 
I just highlight it like you would to a paragraph in MS word, the buttons
will become undimmed.
 
Back
Top