E
Evan M.
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>
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>