M
Michael Ramey
Hi,
I'm dynamically creating a table of "delete" imagebuttons, that correspond
to files on the webserver. I want to respond to clicks of these buttons, so
I know to know what file to delete. Here is the code I'm using
Dim imgShow As New ImageButton
imgShow.CommandName = "Delete"
imgShow.CommandArgument = arrayOfFiles(i)
AddHandler imgShow.Command, AddressOf Image_Command
'Then I proceed to add this button to a table, and loop again for each file
Public Sub Image_Command(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
If e.CommandName = "Delete" then
'do the delete code
End If
End Sub
This works great, but in order to use the AddHandler, the button must still
exist on the postback page. My problem, this is a delete button, so I don't
want to recreate the button. Does anyone have any ideas on how I can handle
this easily?
Thanks
--Michael
I'm dynamically creating a table of "delete" imagebuttons, that correspond
to files on the webserver. I want to respond to clicks of these buttons, so
I know to know what file to delete. Here is the code I'm using
Dim imgShow As New ImageButton
imgShow.CommandName = "Delete"
imgShow.CommandArgument = arrayOfFiles(i)
AddHandler imgShow.Command, AddressOf Image_Command
'Then I proceed to add this button to a table, and loop again for each file
Public Sub Image_Command(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
If e.CommandName = "Delete" then
'do the delete code
End If
End Sub
This works great, but in order to use the AddHandler, the button must still
exist on the postback page. My problem, this is a delete button, so I don't
want to recreate the button. Does anyone have any ideas on how I can handle
this easily?
Thanks
--Michael