Link to home
Start Free TrialLog in
Avatar of SamJolly
SamJollyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.NET weird issue, AddHandler does not seem to work...

Hi,

I am creating at runtime a linkbutton and need to add a "delete.click" event handler. However the debugger passes through the correct code, but the handler does not seem to be added. Cerainly when I clicked on the "delete" link button I do not trick the event.

 
lbtnDelete = New LinkButton()
        Dim strCommandArg As String = (((tblTable.Rows.Count) - 1) + 1).ToString
        lbtnDelete.ID = "_lbtnDelete" & strGuid
        lbtnDelete.Text = "NewDelete"
        lbtnDelete.CommandName = "Delete"
        lbtnDelete.CommandArgument = strCommandArg
        AddHandler lbtnDelete.Click, AddressOf _lbtnDeleteRow_Click
        rowNew.Cells(5).Controls.Add(lbtnDelete)

Open in new window


Where I create table rows from XML, this code works fine. It is just when I add a new row I have a problem.

Thoughts??? and thanks in advance for any help,

Sam
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SamJolly

ASKER

thks