470,609 Members | 1,550 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,609 developers. It's quick & easy.

Events not firing from dynamically instantiated classes.

Ok, this is going to be a long post, so I apologize in advance, but if
it was an easy question I would have probably found an answer somewhere
out here by now...

The short story of this is that I am creating a "process framework"
that allows for common web controls to be linked together in a
procedural fashion, and will also allow for code to be added to these
controls (IE New button events, etc). I have basically created a static
"conductor" class that reads in the class name for each the steps of
the process from the database, and then stores those objects in a
private hashtable member (thus making the steps static as well). Heres
a more detailed list of what happens:

1. The Step ID's are read in from the database, and the classes of each
step are instantiated ( using Activator.CreateInstance(System.Type,
string[]) ).
2. The Initialize method of the steps are called when they are each
( Note: The ProcessStep class actually implements a placeholder)
3. The conductor class then executes the current step in the process by
calling it's execute method, then it casts the ProcessStep to a
placeholder and puts it onto the page.
4. The ProcessStep's control collection has a button that implements
the "IncrementProcess" event handler that actually increments the step,
so that after a postback, if the process has been incremented, it calls
the execute method of the next step, otherwise executes the "current"
step, and casts it to a placeholder, putting it onto the page,
basically doing this till the process is complete.

So as you can see, this is a loose framework that allows for people to
code up webpages, and then link them together to get something more
complicated than a single page can accomplish.

Ok, so for the problem, again I have a (static) collection of
placeholders, which contain buttons. The placeholders are instantiated
dynamically (thus the buttons are instantiated dynamically in a way as
well, I mean, the buttons are all created programattically, no
designer), and for some reason, the buttons events are not firing... I
am at a total loss on this one.

I don't know how to explain it any clearer, I have some detailed
documentation on how the process framework works, but I can't post
attachments here, and it is a few pages long.

I have the complete code base available if anyone wants to look it over
(email me at mu**********@austin.rr.com). This code is a different
version from what is available at
they just haven't updated to my latest code that I emailed them the
other day. But that article basically explains what I am doing.

Please, someone help, I am going crazy over this! This is for an
opensource project so you can chalk it up on your karma board if it
requires for ya to load up the code and look it over ;)

Andy Baldwin

Nov 19 '05 #1
1 1369
Some additional information that I found out last night includes:

1. The fact that I am using Activator.CreateInstance doesn't have
amything to do with it.
2. NONE of the events are firing from the placeholders buttons.
3. Even casting the step to a placeholder in the codebehind file
doesn't work (it is currently being cast in a ProcessViewer control).

Please let me know if you guys have any ideas...


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by JPRoot | last post: by
3 posts views Thread by Mike | last post: by
1 post views Thread by Bob | last post: by
9 posts views Thread by Erik Frey | last post: by
5 posts views Thread by Paal Berggreen | last post: by
4 posts views Thread by jehugaleahsa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.