Only one problem with this, and that is the fact that I only want 1 of the foto's. It's for an overview of occasions, and in the overview I don't want to load all the fotos. Which is why I wouldn't want a repeater for that, just the first foto in my list.
I'm now looking at creating a simple import for the xml, that will grab everthing and put it into SQL Server, making it possible for me to create a dataset that will just grab all the occasions, and their first foto. I think that may just be an easier way, and quicker to boot. Cause I think loading the information from SQL Server will be hell of a lot faster than loading it from live XML.
Thanks, and any other thoughts are definately appreciated.
Regards,
Max.
Main Topics
Browse All Topics





by: TKOTCPosted on 2008-09-03 at 16:00:32ID: 22382866
The problem is that your XML has different tables in it. If you put a breakpoint on your DataSet I am sure that you would see there is a occasions table that stores brand information, a fotos table that stores the brand to foto relationship and a foto table that has the urls for the photos in it.
The easiest method (without too much coding) would be to add a repeater inside your DataList. Something like:
<asp:DataList ID="dlOccasions" runat="server" RepeatColumns="2" RepeatDirection="Horizonta l">
<ItemTemplate>
<div class="auto">
<div class="autofoto">
<asp:Repeater DataSource='<% GetFotos(Eval("ID")) %>' runat="server" id="whatever">
<ItemTemplate><img src='<%Eval("UrlField") %>' alt="something else"/></ItemTemplate>
</asp:Repeater>
<div>
<div class="autodetails">
<span class="merk"><%#Container.Da
<span class="modeluitvoering"><%#C
<img src="/images/spacer.gif" border="0" width="1" height="5" /><br />
<span class="bullet"><%#Container.
<span class="bullet"><%#GetFuel(Co
<span class="bullet"><%#GetSchakel
<span class="bullet"><%#CLng(Conta
</div>
</div>
</ItemTemplate>
</asp:DataList>
Then Code behind
private function GetFotos(ByVal occasionID as int) as DataTable
Dim returnTable as DataTable
'get the link between the fotos table and the foto table and load the foto urls in the returnTable
return returnTable
end function
This should be enough to get the job done, if you cannot get it to work postback and I will create a sample instead of psudo code.
Cheers