B
bg
Hi!
How do I check if "date" exists before using that code?
I've built a RSSreader and sometimes there's a date in it and sometimes not.
How can I check if it exists to avoid crash (DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name date)
<aspataGrid
id="RssNewsGrid"
AutoGenerateColumns="False"
runat="server"
AlternatingItemStyle-BackColor="#ffffff"
HeaderStyle-BackColor="#ffffff"
OnPageIndexChanged="ChangePaging"
AllowPaging="True"
Width="100%"
Cellpadding="4"
BorderWidth="0">
<PagerStyle Mode="NumericPages" Visible="False" HorizontalAlign="Right" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<h2 class="<%=HeaderClass2%>"><%# DataBinder.Eval(Container.DataItem,
"title") %></h2>
<em><%# DataBinder.Eval(Container.DataItem, "date") %>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
Thank you
/Stefan
How do I check if "date" exists before using that code?
I've built a RSSreader and sometimes there's a date in it and sometimes not.
How can I check if it exists to avoid crash (DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name date)
<aspataGrid
id="RssNewsGrid"
AutoGenerateColumns="False"
runat="server"
AlternatingItemStyle-BackColor="#ffffff"
HeaderStyle-BackColor="#ffffff"
OnPageIndexChanged="ChangePaging"
AllowPaging="True"
Width="100%"
Cellpadding="4"
BorderWidth="0">
<PagerStyle Mode="NumericPages" Visible="False" HorizontalAlign="Right" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<h2 class="<%=HeaderClass2%>"><%# DataBinder.Eval(Container.DataItem,
"title") %></h2>
<em><%# DataBinder.Eval(Container.DataItem, "date") %>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
Thank you
/Stefan