Hi,
I'm creating a file-browser in ASP.Net but I have run into a problem which I believe relates to event-wireing on dynamic controls. I'll explain what my code does here:
When my page loads (OnLoad) i call a method (createStuff()) that create a number of linkbuttons (representing folders in a current directory) which are wired to an event that changes the current directory to the one that is associated with the linkbutton.
Since a linkbutton-click-event is fired after OnLoad is called (and the current directory therefore is first changed after onload) the linkbuttons doesn't update to reflect the new current directory (they are created before the current directory is changed by the click-event). Therefore I also call createStuff() in OnLoadComplete resulting in the linkbuttons being updated and reflecting the folders in the new current directory.
HOWEVER (and this is my problem) it seems that the event wireing (Click += new EventHandler(changeDirectory)) I do in createStuff() doesn't really work when the method is called in OnLoadComplete (OnLoadComplete is called after a linkbutton-click-event has been fired). The result is that while the text-property of the linkbuttons reflect the folders in the new directory clicking the linkbuttons doesn't fire the event.
How can I fix this problem? I tried rewireing the events on the LinkButtons in OnLoad but same result.
Thank you in advance
Simon, Denmark