By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,088 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,088 IT Pros & Developers. It's quick & easy.

Events not firing from dynamically instantiated classes.

P: n/a
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
instantiated.
( 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
http://www.codeproject.com/aspnet/RapidWebAppDev.asp
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
mu**********@austin.rr.com

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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...

AB

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.