Reputation: 7153
I'm going through a repeater databound sub.
The data in the repeater can depend on what is selected in a dropdown, but some of my sql that is being used to display the data doesn't have a column price
- how can I say e.g. "if exists "price" e.g.
I was trying:
If Not CType(e.Item.DataItem, DataRowView) Is DBNull.Value Then
'Do this
end if
Any ideas?
Upvotes: 0
Views: 190
Reputation: 460058
DataItem
is always nothing/null on postbacks, it's only set after databinding. Values are maintained in ViewState
(by default) across postbacks, so there's no need to maintain the datasource.
So you should use e.Item.FindControls(controlID)
instead.
Upvotes: 2