User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,527 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,801 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1691 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Datalist Repeater Help

  #1  
Oct 1st, 2007
I need a way to write a certain line to the itemtemplate inside the datalist control if the current row being written is 1. This is what I have:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>

<asp:DataList ID="MyDataList" RepeatColumns="2" runat="server">
<ItemTemplate>

<a href="/Vegas2/Celebrities/celebritybio.aspx?CelebID=<%# DataBinder.Eval(
Container.DataItem, "CelebID") %>">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table class="handlink" border="0" cellspacing="0" cellpadding="0"
 onMouseOver="c2On(this);" onMouseOut="c2Out(this);"
  onClick="window.location='/Vegas2/Celebrities/celebritybio.asp?CelebID=
  <%# DataBinder.Eval(Container.DataItem, "CelebID") %>'">


'[if this is the first row, write the following:
'<tr>
'<td colspan="4"><img src="/Vegas2/images/2w12.gif" alt="" /></td>
'</tr>
'end the if]


<tr>
<td height="4" colspan="4"></td>
</tr>
<tr>
<td width="10"></td>
<td width="100" valign="center"><img src="<%# DataBinder.Eval(Container.DataItem,
 "CelebPicSm") %>" alt="" /></td>
<td width="10"></td>
<td width="140"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="4"></td>
</tr>
<tr>
<td class="smalltxt">Name:&nbsp;&nbsp;<strong><%# DataBinder.Eval(Container.DataItem,
 "CelebName") %></strong></td>
</tr>
<tr>
<td class="smalltxt">DOB:&nbsp;&nbsp;<%# String.Format("{0:d}",(DataBinder.Eval(
Container.DataItem, "DateofBirth"))) %></td>
</tr>
<tr>
<td class="smalltxt">
Age:&nbsp;&nbsp;<%# Age((String.Format("{0:d}",(DataBinder.Eval(Container.DataItem,
 "DateofBirth")))),(DataBinder.Eval(Container.DataItem, "Dead"))) %> </td>
</tr>
<tr>
<td class="smalltxt">Career:&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem,
 "Career") %></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="4" height="4"></td>
</tr>
<tr>
<td colspan="4"><img src="/Vegas2/images/2w12.gif" alt="" style="margin-top:3px;" /></td>
</tr>
</table>
</td>
<td width="4"></td>
</tr>
</table>
</a>
</ItemTemplate>
</asp:DataList>

</td>
</tr>
<tr>
<td height="8"></td>
</tr>
</table>

I need to write an image to complete the surrounding box. If I have it write both at the top, and bottom, the separator becomes thick, and does not look nice. The image needs to be written above where it is said, but only if it is the first record being written. I cannot deal with the HeaderTemplate as some records will only return one result. If I use the header template to add the image to both columns and only one record is displayed viewing only one column, obviously it looks off. Thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Datalist Repeater Help

  #2  
Oct 3rd, 2007
I still need help on this.

I need a hint on what to do, if anyone can help. I need to make a function or if statement for a DataList that basically says:

IF this is first row THEN
write your image
END IF

BUT it also needs to work on both columns. I'd use the headertemplate but sometimes there's only one record, sometimes more. Should I use a function to see if there is only one record, and if so write to the header accordingly to fit one header? hmm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:17 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC