"Joel Daniels" <Jo*********@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
Hello,
I am trying to determine the proper way to access the underlying data row
for a Repeater item in the ItemCommand event. In the page load event, I
bind
the Repeater data source to a SqlDataReader. I check for !IsPostBack so
the
data binding only happens the first time.
In the ItemCommand event, e.Item.DataItem is unassigned. Any suggestions?
It's supposed to be unassigned. What would it be set to? There's no data on
post back!
If you supply the DataKey property property to the DataGrid when you
DataBind it, then you can use the ItemIndex of the RepeaterItem to index
into the DataKeys property of the DataGrid. Given the primary key of the
DataRow which originally loaded that Repeater item, you can load it again.
John Saunders