DataGrid AddRow during ItemDataBound

G

Guest

Relatively new to .NET so please bear with me... I'm making an ASP.NET web
application and am using VB to code. I'll try to set the stage here... The
class and property names are generic to make the question simpler.

First off, I've got three classes:

Class MyItem
Public Name As String
Public ItemError As MyItemError
End Class

Class MyItemError
Public ID As Int32
Public Description As String
End Class

Class MyItemCollection
Inherits ArrayList
End Class

I'm populating a MyItemCollection with several instances of the MyItem
class, and then binding MyItemCollection to a data grid.

The desired effect is to have a datagrid displaying all of the MyItem's
within a MyItemCollection and to only display the error description if the
particular MyItem instance has an error associated with it. What I'd like to
do is add a new row to the datagrid to display MyItem.ItemError.Description
ONLY IF MyItem.ItemError.ID is greater than zero...

I'm pretty confident that I can dynamically add a row to a datagrid within
the ItemDataBound event (correct me if I'm wrong), but what I can't seem to
figure out, or find direction only for, is how to type the particular
datagrid row as that specific instance of MyItem so that I can look at the
MyItem.ItemError property. It's not a displayed cell (using a templated
datagrid) so I can't access it through e.Item.Cells()...

Any guidance would be greatly appreciated.

TIA - TB
 
G

Guest

(re-phrased this question in a new thread: "Accessing Ignored Class
Properties during ItemDataBound")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top