make sure youre only passing the item if
e.Item.ItemType = Item OrElse e.Item.ItemType = AlternatingItem.
Those are the only types for which DataItem is valid. If you try to refer to
it on a type Header, Pager, Footer, youll get that error.
"anonymous" <anonymousdiscussions.microsoft.com> wrote in message
> I need to pass e.item.dataitem to my user control,
> from the ItemCommand method. But each time I do this, I
> get the following error:
> Object variable or With block variable not set.
> It happens when I access the data. Its something like this:
> Private Sub Dg_ItemCommand...
> Dim drv As Object = e.Item.DataItem
> objUC.Binddata(drv(1), drv(2), "%", "%","%")
> End Sub
> Any idea?