I'm in a bit of a pickle. I'm trying to custom-format some data and edit the data as it occurs.
However, sometimes the data is not present. For example, the data may be in the normal format:
A
>B
>C
>D
>E
(where > is a subelement of the parent) However, sometimes my data comes back missing B and C, but still successfully renders "normally", but those fields are left blank.
My ItemTemplate displays things in a different format, i.e.
<ItemTemplate>
<table border=0><tr><td><%# Eval( "A" ) %></td><td><%# Eval( "B" ) %></td></tr>
<tr>...Rest of the elements here</tr>
</table>
</ItemTemplate>
However, when I try to render "B" and it is missing, it causes all kinds of nasty issues. Is there a way to check if this exists in the ItemDataBound event and if not, inject a new value?
Also, is there a way to possibly "skip" it on the ItemDataBound, i.e. if a column is missing, don't even bother showing the entire row? Is there any kind of GridDataItem.ContainsKey() or something to verify existence of keys, etc?
Thanks!
However, sometimes the data is not present. For example, the data may be in the normal format:
A
>B
>C
>D
>E
(where > is a subelement of the parent) However, sometimes my data comes back missing B and C, but still successfully renders "normally", but those fields are left blank.
My ItemTemplate displays things in a different format, i.e.
<ItemTemplate>
<table border=0><tr><td><%# Eval( "A" ) %></td><td><%# Eval( "B" ) %></td></tr>
<tr>...Rest of the elements here</tr>
</table>
</ItemTemplate>
However, when I try to render "B" and it is missing, it causes all kinds of nasty issues. Is there a way to check if this exists in the ItemDataBound event and if not, inject a new value?
Also, is there a way to possibly "skip" it on the ItemDataBound, i.e. if a column is missing, don't even bother showing the entire row? Is there any kind of GridDataItem.ContainsKey() or something to verify existence of keys, etc?
Thanks!