Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering datagrid cell contents

Status
Not open for further replies.

DaedalusPrime

Programmer
May 25, 2005
13
US
Just a quick question:

Is it possible to center the contents of all cells in a datagrid? I'm sure it's just some property or something that I've overlooked.

Thanks!
 
Sorry,

I should have given you more.
If it is a windows application you will want to have dataGridTableStyles defined. Somewhere in there you will define each column and have some code such as:

this.dataGridTextBoxColumn1.Alignment = System.Windows.Forms.HorizontalAlignment.Center;

You can do this kind of stuff with the wizards as well.

If it is a WEB application you can set the properties on the Datagrid or code directly in the HTML

HorizontalAlign="center"

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top