Css in DataList?

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I am trying to format a datalist with a css style.
Trouble is i want the first two elements styled one way and the rest another, Like so:


Joe Blow
1234 Street
Nowhere, NW

Do I have to trap the ItemCreated event and handle it that way? If so how do I determine when the item being created is the one I want.

The Datalist is:

<asp:datalist
id=dlstNewMem
style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 256px"
runat="server"
CellSpacing="10"
RepeatDirection="Horizontal"
RepeatColumns="2">

<ItemTemplate>
<table>
<tr>
<td><%# Container.DataItem( "FirstName" )%> <%# Container.DataItem( "LastName" )%></td>
</tr>
<tr>
<td><%# Container.DataItem( "Title" )%></td>
</tr>
<tr>
<td><%# Container.DataItem( "Phone" )%></td>
</tr>
<tr>
<td><%# Container.DataItem( "eMailLogin" )%></td>
</tr>
</table>

</ItemTemplate>

<SeparatorTemplate>
<hr>

</SeparatorTemplate>
</asp:datalist></form>
 
Just stick the two items inside a <span> tag:

<tr>
<td><span style="style goes here"><%# Container.DataItem( "FirstName" )%> <%# Container.DataItem( "LastName" )%></span>
</td>
</tr>
 
Don't know why but that isn't getting it done for me. I get no formatting when I apply the span:


<asp:datalist
id=dlstNewMem
style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 256px"
runat="server"
CellSpacing="10"
RepeatDirection="Horizontal"
RepeatColumns="2">

<ItemTemplate>
<table>
<tr>
<td><span style="StandOut"> <%# Container.DataItem( "FirstName" )%> <%# Container.DataItem( "LastName" )%></span></td>
</tr>
<tr>
<td><span style="StandOut"><%# Container.DataItem( "Title" )%></span></td>
</tr>
<tr>
<td><%# Container.DataItem( "Phone" )%></td>
</tr>
<tr>
<td><%# Container.DataItem( "eMailLogin" )%></td>
</tr>
</table>

</ItemTemplate>

<SeparatorTemplate>
<hr>

</SeparatorTemplate>
</asp:datalist></form>
 
I know that the .css is being recognized on the page because I can apply a style to the entire datalist using

CssClass="HeadTwoBlack"

but not to different elements using the span
 
Back
Top