Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to align items vertically on a datagrid

Reply
Thread Tools

How to align items vertically on a datagrid

 
 
Julia B
Guest
Posts: n/a
 
      01-29-2008
Hi, I'm working with .net version 1.1.

I've got a datagrid on a webform that my users want a fixed height, which is
fine. It can contain up to 10 records. If there are 10 records then it's fine
and looks very nice. However if there is only 1 record (or just a few) then
it looks daft, because the records aren't vertically aligned at the top.

I can't find a vertical alignment property for a datagrid. Is there a way of
working this so that the records will always be placed at the top?

Thanks
Juia
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-30-2008
Don't set any height attribute for the grid and it will align the rows
nicely. Instead, put the grid in a <div> and set the height for the div. You
can create an impression that the grid fills up the whole height of the
<div> even if it has less than 10 records by setting the same background
color for the grid and the <div>.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Julia B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, I'm working with .net version 1.1.
>
> I've got a datagrid on a webform that my users want a fixed height, which
> is
> fine. It can contain up to 10 records. If there are 10 records then it's
> fine
> and looks very nice. However if there is only 1 record (or just a few)
> then
> it looks daft, because the records aren't vertically aligned at the top.
>
> I can't find a vertical alignment property for a datagrid. Is there a way
> of
> working this so that the records will always be placed at the top?
>
> Thanks
> Juia



 
Reply With Quote
 
 
 
 
Julia B
Guest
Posts: n/a
 
      01-30-2008
Thanks Eliyahu, however that's not going to work, I don't think. I've already
got it in a layout which has a set height, however the datagrid itself,
although having the same colour background, has a border round the edge and
vertical column borders, which the users require. This means that the actual
grid size would be visible.

Julia

"Eliyahu Goldin" wrote:

> Don't set any height attribute for the grid and it will align the rows
> nicely. Instead, put the grid in a <div> and set the height for the div. You
> can create an impression that the grid fills up the whole height of the
> <div> even if it has less than 10 records by setting the same background
> color for the grid and the <div>.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Julia B" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi, I'm working with .net version 1.1.
> >
> > I've got a datagrid on a webform that my users want a fixed height, which
> > is
> > fine. It can contain up to 10 records. If there are 10 records then it's
> > fine
> > and looks very nice. However if there is only 1 record (or just a few)
> > then
> > it looks daft, because the records aren't vertically aligned at the top.
> >
> > I can't find a vertical alignment property for a datagrid. Is there a way
> > of
> > working this so that the records will always be placed at the top?
> >
> > Thanks
> > Juia

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-30-2008
Your last resort would be to produce always exactly 10 columns. If you have
less than 10 data rows, add some empty ones. I would do it on the
datasource.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Julia B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Eliyahu, however that's not going to work, I don't think. I've
> already
> got it in a layout which has a set height, however the datagrid itself,
> although having the same colour background, has a border round the edge
> and
> vertical column borders, which the users require. This means that the
> actual
> grid size would be visible.
>
> Julia
>
> "Eliyahu Goldin" wrote:
>
>> Don't set any height attribute for the grid and it will align the rows
>> nicely. Instead, put the grid in a <div> and set the height for the div.
>> You
>> can create an impression that the grid fills up the whole height of the
>> <div> even if it has less than 10 records by setting the same background
>> color for the grid and the <div>.
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "Julia B" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi, I'm working with .net version 1.1.
>> >
>> > I've got a datagrid on a webform that my users want a fixed height,
>> > which
>> > is
>> > fine. It can contain up to 10 records. If there are 10 records then
>> > it's
>> > fine
>> > and looks very nice. However if there is only 1 record (or just a few)
>> > then
>> > it looks daft, because the records aren't vertically aligned at the
>> > top.
>> >
>> > I can't find a vertical alignment property for a datagrid. Is there a
>> > way
>> > of
>> > working this so that the records will always be placed at the top?
>> >
>> > Thanks
>> > Juia

>>
>>
>>



 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      01-30-2008
How about padding the datagrid to ten items with blanks?

Andrew


 
Reply With Quote
 
Julia B
Guest
Posts: n/a
 
      01-30-2008
Good idea and thanks to both of you for that.

"Andrew Morton" wrote:

> How about padding the datagrid to ten items with blanks?
>
> Andrew
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
CSS Vertically Align Text Trevor HTML 5 04-29-2006 02:31 PM
how can align the text vertically in a table cell atin45gupt@gmail.com HTML 1 01-17-2006 04:25 PM
vertically align absolutely positioned div elements Guybrush Threepwood HTML 1 12-14-2005 09:29 PM
div Wont Vertically Align homer HTML 6 01-28-2005 05:04 AM



Advertisments