Dynamically added WebControls requiring TWO clicks to fire event?!?

I

iamurbal

Any help would be much appreciated. I am fairly well versed in .Net
and feel I am perhaps "almost there", I must be missing something
small.

Issue
------
I have an asp:table that I am dynamically adding imageButton controls
to. After I add the image button to the row, I add an eventHandler to
the control. Now the imageButton renders fine. Now when i click the
image button, the event does _not_ fire.... BUT, if I click the exact
same control a second time, the event handler fires.

I have tried searching and researching and everything I've found leads
to the page build order and suggestions I have read all refer to
building the control in the page_init() rather than the page_load()
event, which I have tried, yet I still get the same results. Here's
the gist of the code...

code
------

sub page_init()

InitializeComponent()

' Call sub to dynamically build table and add controls
loadMenus()

end sub

sub loadMenus()

' Build row...
' Create imageButton...
' Add imageButton to row...
' Add eventHandler to _command() of imageButton...
' Add row to table...

end sub

sub imageButton_command()

' Get command arguments to see which menuItem was clicked...
' store menuID and menuItemID in variables

' now call loadMenus again with my new ID's
loadMenus()
end sub


Any help is greatly appreciated.

-e
 

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,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top