Hi
Problem: How to get Linq to make a default value of 'noImage.jpg' if null is returned from the database.
I'm querying a single table:
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Materials.MaterialsDataClassesDataContext"
TableName="Materials" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
</asp:LinqDataSource>
then displaying images:
<telerik:GridTemplateColumn HeaderText="Image" UniqueName="Image">
<ItemTemplate>
<a href="<%=VirtualPathUtility.ToAbsolute("~/")%>showFrontEndMaterialDetail.aspx?materialId=<%# Eval("Id")%>">
<img src="<%=VirtualPathUtility.ToAbsolute("~/")%>Images/Uploaded/Thumbs/<%# Eval("Image1") %>"></img></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
I thought I had it (but didn't) with:
<%# (string?)Eval("Image1") ?? "noImage.jpg" %>