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

datalist templates

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have a datalist that I am trying to have if the value of lastName is equal to zzzzzzzz then the text would be white. Otherwise it is a normal color. This is what I have so far which isn't write. I tried several varations but don't know how to check the value.

<asp:dataList ID=&quot;fstfloor&quot; CellPadding=&quot;15&quot; CellSpacing=&quot;10&quot; GridLines= &quot;none&quot; RepeatColumns=&quot;3&quot; RepeatDirection=&quot;Vertical&quot; runat=&quot;server&quot;>
<itemtemplate>
<td>
<%# if Container.DataItem( &quot;lastName&quot; ) = &quot;zzzzzzzz&quot; Then %>
<font color=&quot;#FFFFFF&quot;>
<%# Container.DataItem( &quot;lastName&quot; ) %>
</font>
<% else %>
<%# Container.DataItem( &quot;lastName&quot; ) %>
<% end if %>
</td>
<td>
<%# Container.DataItem( &quot;firstName&quot; ) %>
</td>
<td>
<%# Container.DataItem( &quot;phonenumber&quot; ) %>
</td>
</itemtemplate>
</asp:DataList>
 
The event you need is the &quot;itemDataBound&quot; event. Do a search on google for &quot;datalist itemdatabound&quot; and you'll see many examples of what you're asking.

And those examples will be much more in-depth and thorough than I could be here q&d, which is why I refer you to other resources.

Post back to this thread if you run into specific problems with the event, and we'll work them out.

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top