Can someone please show me how to set a different style for each cell in a datalist? Right now the generated html for my datalist gives something like:
All have the same daycss style for each td cell, but now I want it to have a different css for each day, that can be pulled from the db. For example, Monday row would need a style called moncss and Tuesday tuescss,etc..
pkd
Member
136 Points
32 Posts
DataList css style
Dec 04, 2006 04:57 PM|LINK
Hi,
Can someone please show me how to set a different style for each cell in a datalist? Right now the generated html for my datalist gives something like:
<tr>
<td class="daycss" align="Left" valign="Top" style="background-color:#EEEEEE;height:20px;">
<div style="PADDING-LEFT:26px; PADDING-TOP:1px">Monday</div> </td>
</tr>
<tr>
<td class="daycss" align="Left" valign="Top" style="background-color:#EEEEEE;height:20px;">
<div style="PADDING-LEFT:26px; PADDING-TOP:1px">Tuesday</div> </td>
</tr>
<tr>
<td class="daycss" align="Left" valign="Top" style="background-color:#EEEEEE;height:20px;">
<div style="PADDING-LEFT:26px; PADDING-TOP:1px">Wednesday</div> </td>
</tr>
All have the same daycss style for each td cell, but now I want it to have a different css for each day, that can be pulled from the db. For example, Monday row would need a style called moncss and Tuesday tuescss,etc..
Is this possible?
Thanks.
Rick Rataycz...
Member
652 Points
140 Posts
Re: DataList css style
Dec 04, 2006 06:49 PM|LINK
Sure, in the code behind, make a public function:
Public Function GetDayCss(ByVal day As String) As String Return day.ToLower + "Css" End FunctionIn the asp.net page, for example: