Accessing Delete Command from a button in a Repeater Control

Discussion in 'ASP .Net' started by MU, Jan 20, 2009.

  1. MU

    MU Guest

    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
    MU, Jan 20, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elliot M. Rodriguez

    suppressing Submit command with a Delete button

    Elliot M. Rodriguez, Dec 16, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    432
    Elliot M. Rodriguez
    Dec 17, 2003
  2. Replies:
    0
    Views:
    848
  3. Roger Twomey

    Add Confirm to Delete button in repeater

    Roger Twomey, Jun 4, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    334
    Morgan
    Jun 5, 2004
  4. Cappy

    Accessing data object on delete command.

    Cappy, Apr 20, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    137
    Elton W
    Apr 20, 2005
  5. Replies:
    1
    Views:
    167
Loading...

Share This Page