Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 14th, 2006, 03:44 PM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Show item in datalist control

Hi,
I have some fields from an access databases and I output them into a datalist like the code below
Now how can I for ex. specify if the image field is empty the item does not show up in the datalist


<asp:DataList width="98%" id="LinkCat" OnItemDataBound="LinkCat_ItemDataBound" RepeatColumns="1" runat="server">
      <ItemTemplate>
    <div >
       <div class="divhd">
<span class="bluearrow">»</span>&nbsp;
<a class="dtcat2" title="" href='<%# DataBinder.Eval(Container.DataItem, "NewsID", "viewNews.aspx?id={0}") %>' ><%# DataBinder.Eval(Container.DataItem, "headline") %></a> <asp:Label ID="lblpopular" cssClass="hot" runat="server" /> <asp:Image ID="newimg" runat="server" /> <asp:Image ID="thumb" AlternateText ="Thumbs up" runat="server" visible="false" />
</div>
<div class="divbd">
<div class="divlink2">
<a class="dt5" title="Homepahe" href="index.aspx">Home</a>&nbsp;»&nbsp;<a class="dt5" title="Go to category" href="newsList.aspx?catid=<%# DataBinder.Eval(Container.DataItem, "CATID") %>&tab=1"><asp:Label ID="lblcatname2" runat="server" /></a>&nbsp;»&nbsp;<a title="" class="dt5" href="newsList.aspx?tab=1&catid=<%# DataBinder.Eval(Container.DataItem, "CATID") %>><asp:Label ID="lblsubname2" runat="server" /></a>
</div>
<div style="padding-top: 1px; padding-bottom: 3px; padding-left: 6px;">
<span class="descrip"></span> <asp:image id="img1" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "short_News") %></div>
<div style="padding-top: 1px; padding-bottom: 2px; padding-left: 6px;">
<span class="content12">
<strong>Hits:</strong> <span class="cmaron3"><%# DataBinder.Eval(Container.DataItem, "Hits") %></span> &nbsp;|&nbsp;
<strong>Rating:</strong>&nbsp;<img src="images/<%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1, -2, -2, -2) %>.gif" style="vertical-align: middle;" alt="Rating <%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1, -2, -2, -2) %>">&nbsp;( <%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1, -2, -2, -2) %> ) by <%# DataBinder.Eval(Container.DataItem, "No_RATES") %> users</span>
</div>
<div style="padding-top: 1px; padding-bottom: 2px; padding-left: 6px;">
<span class="content12">
<strong>Added:</strong> <span class="cmaron3"><%# FormatDateTime(DataBinder.Eval(Container.DataItem, "DATE"),vbShortDate) %></span>&nbsp;|&nbsp;<a class="dt5" title="Email <%# DataBinder.Eval(Container.DataItem, "Headline") %> News to friend" href="JavaScript:openWindow('tell_a_friend.aspx?id =<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;n=<%# DataBinder.Eval(Container.DataItem, "headline") %>')">Email Link</a>&nbsp;|&nbsp;<a title="Read / Write a Review on <%# DataBinder.Eval(Container.DataItem, "NewsID") %> link" class="dt5" href="viewNews.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>">Read review </a>
</span>
</div>
<div style="padding-top: 1px; padding-bottom: 2px;">
<span class="content12"><strong>&nbsp;&nbsp;Rate News:</strong>&nbsp;</span>
<ul class='srating'>
  <li><a href='#' onclick="javascript:top.document.location.href='ra telink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=1';" title='Not sure - 1 star' class='onestar'>1</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ra telink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=2';" title='Fair - 2 stars' class='twostars'>2</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ra telink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=3';" title='Interesting - 3 stars' class='threestars'>3</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ra telink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=4';" title='Very good - 4 stars' class='fourstars'>4</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ra telink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=5';" title='Excellent - 5 stars' class='fivestars'>5</a></li>
</ul>
   </div>
  </div>
</div>

      </ItemTemplate>
  </asp:DataList>
</td>
  </tr>
</table>

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Aligning Header & Item DataList Templates rsearing ASP.NET 2.0 Basics 2 October 5th, 2007 06:09 AM
How to delete an item of a xml file from datalist? MTLedari ASP.NET 2.0 Professional 0 April 23rd, 2007 03:27 PM
How to show thumbnail in the GridView/DataList walgr2k ASP.NET 2.0 Basics 1 May 20th, 2006 10:17 AM
Show table in DataList miguel.ossa ASP.NET 1.0 and 1.1 Basics 1 February 26th, 2004 10:29 AM
add conditional DataList item jtyson ASP.NET 1.0 and 1.1 Basics 1 July 1st, 2003 01:10 PM



All times are GMT -4. The time now is 04:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.