Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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>

Wanna-Be C# Superstar
  • *Experts*
Posted

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>

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

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>

Wanna-Be C# Superstar
Posted

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

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...