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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Valign in gridview

Status
Not open for further replies.

R7Dave

Programmer
Oct 31, 2007
181
US
Hello - I am trying to have my data in my gridview align to the top of the cell.

The following code is not workingin my grid_rowdatabound event

e.Row.Cells(0).Attributes.Add("style", "valign: top;")

and also

e.Row.Cells(2).Style.Add("valign", "top")

Both do not work

Does anyone know the correct code?

Thanks in advance
Dave
 
In CSS the attribute is vertical-align, so ....
Code:
e.Row.Cells(0).Attributes.Add("style", "vertical-align: top;")
 
That was just what I needed - Thank you very much
 
Hello again - is there a good online reference or a good book that lists what CSS attributes go with what object? I'm very interested in using CSS with gridviews - so I think that would be the same as a table, correct?

I have looked before for a good CSS reference but haven't found a real useful one - a lot of sites state that CSS is the way to go but then don't really give useful examples. I would like to find something that deals specifically with placement (absolute and relative positioning) and manipulating gridviews.

Thanks again
Dave
 
Yes, gridviews just render a table so that is the element you should target. Here's a good starting point:


Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top