S
Steve
I am using a datalist to display a number of records.
Each record has a unique id (RecordID field), which I have set as the
DataKeyField for the datalist.
In the Item Template of the datalist, I have added a button. I want to
be able to retrieve the RecordID of the relevant record when the button
for the record is clicked by the user.
i.e. I want to somehow specify for the click event of the button that
RecordID = the RecordID of the record, whose button was just clicked!
I know I have to use the index property, but I have become confused as
to how to do this.
I tried:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim RecordID As Integer
id = DataList1.DataKeys(e.item.FindControl("RecordID"))
End Sub
But I get the error message:
Error 'item' is not a member of 'System.EventArgs'.
Can somebody help?
Each record has a unique id (RecordID field), which I have set as the
DataKeyField for the datalist.
In the Item Template of the datalist, I have added a button. I want to
be able to retrieve the RecordID of the relevant record when the button
for the record is clicked by the user.
i.e. I want to somehow specify for the click event of the button that
RecordID = the RecordID of the record, whose button was just clicked!
I know I have to use the index property, but I have become confused as
to how to do this.
I tried:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim RecordID As Integer
id = DataList1.DataKeys(e.item.FindControl("RecordID"))
End Sub
But I get the error message:
Error 'item' is not a member of 'System.EventArgs'.
Can somebody help?