Hi Martin,
I've simply added the new fields to the Event and News document types.
Then I simply grab it from the Views....
QueryDataParameters parameters = new QueryDataParameters();
GeneralConnection cn = ConnectionHelper.GetConnection();
DataSet dsEvents = ConnectionHelper.ExecuteQuery("select top 2 * from View_CONTENT_Event_Joined order by EventDate", parameters, QueryTypeEnum.SQLQuery, true);
DataSet dsNews = ConnectionHelper.ExecuteQuery("select top 2 * from View_CONTENT_News_Joined order by NewsReleaseDate", parameters, QueryTypeEnum.SQLQuery, true);
I then bind the datatable to a standard asp:Repeater
<asp:Repeater runat="server" ID="SpotlightRepeater">
<ItemTemplate><li>
<img src="<%# DataBinder.Eval(Container, "DataItem.Teaser")%>" alt="" />
<h4><%# DataBinder.Eval(Container, "DataItem.Title")%></h4>
<p>
%# DataBinder.Eval(Container, "DataItem.Summary")%>
</p>
</li></ItemTemplate>
</asp:Repeater>
This works great, now I just need the path to show the images... I tried the following:
CMSAbstractTransformation imgHelper = new CMSAbstractTransformation();
string sImgPath = string.Empty;
foreach (DataRow row in dsEvents.Tables[0].Rows)
{
sImgPath = imgHelper.GetAttachmentUrl(row["EventTeaserImg"], row["NodeAliasPath"]);
dtEvents.Rows.Add(row["EventName"].ToString(), System.Convert.ToDateTime(row["EventDate"]), row["EventSummary"].ToString(),sImgPath);
}
Thanks
Brendan