I am creating dynamic ImageButtons (ie. a print icon for each row of a dynamic table). I can format the buttons and get them to PostBack, but I cannot work out how to handle the button click event.
I can't create an imgButton_onClick sub in the code behind file as imgButton is created dynamically at runtime, so it doesn't recognise this control/event in the code behind. I have got the following code in the Page_Load sub;
Can someone fill in the blanks for me please?
THanks!
Code:
imgPrint = New ImageButton
With imgPrint
.CausesValidation = True
.CommandName = "imgButton"
.CommandArgument = drRuns("SchoolRunID")
.ToolTip = "Print"
.ImageUrl = "~/images/print.gif"
End With
I can't create an imgButton_onClick sub in the code behind file as imgButton is created dynamically at runtime, so it doesn't recognise this control/event in the code behind. I have got the following code in the Page_Load sub;
Code:
If Not IsPostBack Then
' do some other stuff here
Else
' this is where I want to know if an instance of imgButton was clicked
' how do I do it??
End If
Can someone fill in the blanks for me please?
THanks!