Conditional code in Repeaters



Here's my situation:

I'm creating a blog-like application for my company to do some simple
news updates about new products in and the like that is only used
internally on the intranet.

I have an XML file storing each article that I'm reading into a
DataSet, using a DataView for filtering the DataSet if some search-text
is entered, and a Repeater control to display the data from the
DataView.

The problem that I'm having is that the XML/DataSet also contains path
information to secondary pages, such as PDFs, images, etc., but this
data does not exist for each entry. I need to be able to check if a
piece of data exists (or a value check on an 'exists' column), then add
in additional HTML to do such things as add the image, or set the title
to link to the PDF. Pseudo-code example below.

Anyone have any idea's about how I'd go about doing this? Thanks
Evan M.

<itemtemplate>
<% if DataBinder.Eval(Container.DataItem, "image_path") != null) then
%>
<img src="<%# DataBinder.Eval(Container.DataItem, "image_path") %>"
/>
<% end if %>
<p class="Heading2">
<% if (DataBinder.Eval(Container.DataItem, "pdf_path") != null) then%>
<a href="<%# DataBinder.Eval(Container.DataItem, "pdf_path")%>"><%#
DataBinder.Eval(Container.DataItem, "title") %></a>
<% else %>
<%# DataBinder.Eval(Container.DataItem, "title") %>
<% end if %>
</p>
<div class="Small"><%# DataBinder.Eval(Container.DataItem, "desc")
%></div>
</itemtemplate>

.



Relevant Pages

  • Conditional code in Repeaters
    ... news updates about new products in and the like that is only used ... using a DataView for filtering the DataSet if some search-text ... information to secondary pages, such as PDFs, images, etc., but this ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: word troubles (tif or jpg?)
    ... It is 46 pages long and contains many images ... Greyscale tif and jpg have worked equally well for me in v.X. ... printing method, 150 may or may not be too coarse. ... you might try making your PDFs in two stages. ...
    (microsoft.public.mac.office.word)
  • Re: How can I reduce file size when making PDF from PowerPoint?
    ... > I'm using Acrobat Distiller to create PDFs of PowerPoint presentations, ... How big are the PPT files and how big are the resulting PDFs? ... What sort of images are in your PPTs? ...
    (microsoft.public.powerpoint)
  • Re: Filesize...
    ... You're probably seeing the result of very badly made PDFs. ... manuals and other print material and convert them to PDF w/o a thought for reducing ... > users and professional image quality (they are photos of microbiological ... quality of the images, ...
    (microsoft.public.powerpoint)
  • Re: Review web part for Sharepoint Portal Services
    ... > For a 'reader' vie wwith graphical stars you could create a dataview of ... > image library or just in a folder) then use conditional formatting on each ... > star to control it's visibility based on the value in your Stars field. ... It's not as flashy as real images. ...
    (microsoft.public.sharepoint.portalserver)