Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using a Seven Datalists in my Seven ItemTemplates of a GridView ...

how to align the items of a datalists properly...

if suppose my datalist1 of first itemtemplate of gridview contains Eight items and if my datalist2 of secondi temtemplate of gridview contains only four, then those

four items are displayed in center but not at the top..

How to make them to align at top ?
Posted
Updated 27-Jan-14 17:51pm
v3
Comments
thatraja 27-Jan-14 9:08am    
Confusing.... datalist1 & datalist ???? Post a screenshot. use imgur.com to upload
OR
you could use text format(like ascii drawings) to do the same if you could.
Ahmed Bensaid 27-Jan-14 10:34am    
Did you use css property "vertical-align" ?
Member 10517120 27-Jan-14 23:58pm    
there is no such property for datalist
JoCodes 27-Jan-14 23:52pm    
Add more details to your question

1 solution

Try with

ItemStyle-VerticalAlign="Top" for the TemplateField.

This makes the Datalist inside the TemplateField to top aligned.

Also , use the same for individual Datalist too.
 
Share this answer
 
v2
Comments
Member 10517120 28-Jan-14 0:15am    
it worked tnx a lot
JoCodes 28-Jan-14 0:22am    
You are welcome :)
Member 10517120 28-Jan-14 0:29am    
I'm having a Labels in my Datalist ItemTemplate.

How to Change the Color of the label based upon the text displayed..

i'm using Eval Property to assign text.. which was from db table..

if the text is break then color should be red else it should be green

How to Acheive it plz help
JoCodes 28-Jan-14 0:55am    
Try to set the BackColor or ForeColor property of the label like

BackColorr='<%# Convert.ToString(Eval("Fieldname")) == "break" ? System.Drawing.Color.Blue : Convert.ToString(Eval("FieldName")) == "SomeOtherValue" %>'
Modify the color and fieldnames appropriately. Other way is is to use RowDataBound Event for it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900