473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

center datagrid

I am trying to center a datagrid horizontally on a form, yet it stays
aligned right...
the horizontal align property seems to be useless, just as putting the grid
inside a centered div or table
is there any other way to center the grid?
Nov 19 '05 #1
12 1932
I meant it is currently aligned left
"Vincent Vinet" <vi***********@dessausoprin.com> a écrit dans le message de
news:OM**************@TK2MSFTNGP10.phx.gbl...
I am trying to center a datagrid horizontally on a form, yet it stays
aligned right...
the horizontal align property seems to be useless, just as putting the grid inside a centered div or table
is there any other way to center the grid?

Nov 19 '05 #2
Put it in a table.

<table width="100%">
<tr>
<td align="center">
<your datagrid here>
</td>
</tr>
</table>
"Vincent Vinet" <vi***********@dessausoprin.com> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
I am trying to center a datagrid horizontally on a form, yet it stays
aligned right...
the horizontal align property seems to be useless, just as putting the grid inside a centered div or table
is there any other way to center the grid?

Nov 19 '05 #3
Vincent Vinet wrote:
I am trying to center a datagrid horizontally on a form, yet it stays
aligned right...
the horizontal align property seems to be useless, just as putting the grid
inside a centered div or table
is there any other way to center the grid?

<p align=center>
<div....>
<span...>

lots of options if the control isnt doing it itself

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #4
I would guess that you are not using a table inside of the DataGrid
right? I would suggest that you put all of the information inside of a
table (much MUCH cleaner) and than center the table in the <table> and
<tr> tags.

<table align="center">
<tr align="center">
<td>
My data
</td>
<td>
More data
</td>
</tr>
</table>

You may only need to center one of the <tr> or <table> tags, so you
might want to play around with that.

Hope that helps. =D
Kivak Wolf

Nov 19 '05 #5
Can you really say "<table width="100%">"? I didn't know they allowed
percentages. What will it do?

Nov 19 '05 #6
well unfortunately the contents of the datagrid are based on search results
on a sql server... I cannot enter data manually, although I do have columns
set up in advance, but centering their content does not affect the
datagrid`s placement
"Kivak Wolf" <Li**********@gmail.com> a écrit dans le message de
news:11*********************@o13g2000cwo.googlegro ups.com...
I would guess that you are not using a table inside of the DataGrid
right? I would suggest that you put all of the information inside of a
table (much MUCH cleaner) and than center the table in the <table> and
<tr> tags.

<table align="center">
<tr align="center">
<td>
My data
</td>
<td>
More data
</td>
</tr>
</table>

You may only need to center one of the <tr> or <table> tags, so you
might want to play around with that.

Hope that helps. =D
Kivak Wolf

Nov 19 '05 #7
I have tried it, it doesn't work (well at least not for me :( )
"Peter Rilling" <pe***@nospam.rilling.net> a écrit dans le message de
news:uO**************@TK2MSFTNGP10.phx.gbl...
Put it in a table.

<table width="100%">
<tr>
<td align="center">
<your datagrid here>
</td>
</tr>
</table>
"Vincent Vinet" <vi***********@dessausoprin.com> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
I am trying to center a datagrid horizontally on a form, yet it stays
aligned right...
the horizontal align property seems to be useless, just as putting the

grid
inside a centered div or table
is there any other way to center the grid?


Nov 19 '05 #8
yes, that works
"Kivak Wolf" <Li**********@gmail.com> a écrit dans le message de
news:11**********************@o13g2000cwo.googlegr oups.com...
Can you really say "<table width="100%">"? I didn't know they allowed
percentages. What will it do?

Nov 19 '05 #9
no, don't put the datagrid inside of a table - Put the table inside the
datagrid. Each <tr> and <td> is used to sort out the data inside the
datagrid. Than just center the <table> and <tr> tags.

If you need more help, put your Datagrid here and I will make it for
you.

Nov 19 '05 #10
well it seems that there was a LEFT:9px hidden in the code... and then the
center would just put the LEFT part in the middle of the page so I tried
putting it in a table again and it worked... thanks for your time anyhow :)
Nov 19 '05 #11
I found a pesky piece of code hiding in my source... "left: 9px"
took it out then I put the grid in a centered table of the same width...
works now :)
"Kivak Wolf" <Li**********@gmail.com> a écrit dans le message de
news:11**********************@g43g2000cwa.googlegr oups.com...
no, don't put the datagrid inside of a table - Put the table inside the
datagrid. Each <tr> and <td> is used to sort out the data inside the
datagrid. Than just center the <table> and <tr> tags.

If you need more help, put your Datagrid here and I will make it for
you.

Nov 19 '05 #12
No prob, glad you got it fixed.

Nov 19 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Alex | last post by:
Hi Everone, I need some advice on how to setup 4 columns where the outside two are absolute (120px) and the inner two (side by side) are relevent (Fluid) and change with the screen. Here's my...
3
by: Tom Bernsen | last post by:
This should be simple, I did it with a datagrid easily enough. Using VS Net 1.1, I want a label over the datagrid and a hyperlink below it (from WebForms toolbox), with BOTH of them centered (text...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
2
by: Mrozu | last post by:
Hi How I can set CaptionAlign to Center. I can't find this option in DataGrid Properties... Default align is left... Thx Mrozu
1
by: John Dalberg | last post by:
I am trying to center a checkbox in a datagrid column but the checkbox always displays to the right. Below is the rendered html. I also used a css-class with the same text-align: center attribute....
1
by: Jose | last post by:
Please como center a datagrid header and the data justify to right? Thanks a lot
0
by: slemen | last post by:
Hi, I'm creating column templates dynamically at runtime. How do I center within the column 2 check boxes in each column header? The columns are created using the technique described in MSDN...
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.