Data List Newbie Question

  • Thread starter Thread starter Bishop
  • Start date Start date
B

Bishop

I have a DataList with a command button. When I click the command button it
runs the following sub routine:

Sub DataList_ItemCommand(ByVal s As Object, ByVal e As
DataListCommandEventArgs)

If (e.CommandName = "Details") Then

txtTest.Text = e.Item.ItemIndex

End If

End Sub

The problem I have is that e.Item.ItemIndex always returns a "0". Any ideas
why?
 
You've got the button in the ItemTemplate section of the DataList,
right?
So when you click the first instance of the button,
e.Item.ItemIndex=0, the next button should return 1, then 2 etc. Ain't
gonna work if it's anywhere else, believe me I've tried ;-)
 
Thanks, Turns out it was a problem with the way I had the command button
defined in the alternate item template.
 
Back
Top