Sean,
Is it possible to evaluate a string as a method name?
Something like this:
Session[methodToExecute] = "loadFormFormACompany";
This is what I would like to do.... eval(Session[methodToExecute]+"()")
Anyone have any ideas?
You want to learn about reflection. You can do this and a lot more. Here
is a snippet of code that executes a method who's name is stored in the
"aMethodName" string variable for the "myObject" object. Note that the
method takes zero arguments:
String aMethodName = @"someMethodNameHere";
Object aMethodArguments = new Object[0];
myObject.GetType( ).InvokeMember(
aMethodName,
BindingFlags.InvokeMethod | BindingFlags.NonPublic |
BindingFlags.Instance,
null,
myObject,
aMethodArguments );
I hope that helps.
Regards,
Randy