Accessing Delete Command from a button in a Repeater Control

M

MU

Hello,

How would I access the Delete command from a button in a DataList that
is databound to a SQLDataSource and the whole thing is within a
Repeater control?

This is what I have right now:
Protected Sub lstItineraryDayItems_DeleteCommand(ByVal source As
Object, ByVal e As DataListCommandEventArgs)
Dim dList As DataList = repeaterDays.Controls
(repeaterDays.Controls.Count - 1).FindControl("lstItineraryDayItems")
Dim sqlItin As SqlDataSource = repeaterDays.Controls
(repeaterDays.Controls.Count - 1).FindControl("sqlItineraryDayItems")

Dim id As Integer = CInt(dList.DataKeys(e.Item.ItemIndex))
sqlItin.DeleteParameters("ItineraryDayItemsID").DefaultValue =
id
sqlItin.Delete()
End Sub

But I'm not sure if that is correct and I'm not sure how I would call
if it is....

Any help would be great!

Thanks
 

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

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top