isaacab
asked on
Are Anonymous Methods Allowed Cross-Classes?
Hello All
I have on my website many processes that require a transfer page. For example, I have a login page, the customer has to supply his credentials, then he clicks Submit, then the website takes him to a transfer page (that invokes some methods) and finally redirects him to to the target page.
I have many transfer pages on my website, and I wanna use Anonymous Methods (.Net 2.0) to have one Transfer page that a will allow to assign a Anonymous Method to it.
Is this even doable? and if yes could anyone show an example please? This will be greatly appreciated!
Thanks In Advance.
I have on my website many processes that require a transfer page. For example, I have a login page, the customer has to supply his credentials, then he clicks Submit, then the website takes him to a transfer page (that invokes some methods) and finally redirects him to to the target page.
I have many transfer pages on my website, and I wanna use Anonymous Methods (.Net 2.0) to have one Transfer page that a will allow to assign a Anonymous Method to it.
Is this even doable? and if yes could anyone show an example please? This will be greatly appreciated!
Thanks In Advance.
I dont see how anonymous methods would help you? Just curious....
I think maybe he means delegates?
yeah but why would delegates be needed for a simple redirect?
ASKER
Yes, I mean delegates. I cannot get it work.
Is possible to assign a delegate to an instance of a class? if yes - could you show me some example please?
Thanks in advance.
Is possible to assign a delegate to an instance of a class? if yes - could you show me some example please?
Thanks in advance.
ASKER
I don't need the delegates for a simple redirect, I need them to implement for each instance different lines of code.
The redirection will happen after those code lines will be executed.
I hope I'm clear enough.
The redirection will happen after those code lines will be executed.
I hope I'm clear enough.
Basically you need some function to run before the redirect isnt it?
ASKER
surajguptha,
Correct.
Correct.
Create a common function which will take a few parameters and then redirect it... replace all instances of redirect with this function.
ASKER
OK. Here is my solution:
In my transfer page I have this code snippet:
private EventHandler executeDelegate = null;
This is how the client control looks like:
ASP Page
<%@ Register TagPrefix="uc1" TagName="ctlTran" Src="~/Components/Customer Interactio n/Transfer Customer.a scx" %>
<uc1:ctlTran ID="ctlTran1" runat="server" />
C# Code:
this.ctlTran1.ExecuteDeleg ate = delegate
{
PUT HERE THE CODE TO EXECUTE
};
This works fine to me. I'm sorry if I wasn't clear enough when writing the question.
Thanks Guys for trying to help. I really appreciate it!
Happy New Year to you all
In my transfer page I have this code snippet:
private EventHandler executeDelegate = null;
This is how the client control looks like:
ASP Page
<%@ Register TagPrefix="uc1" TagName="ctlTran" Src="~/Components/Customer
<uc1:ctlTran ID="ctlTran1" runat="server" />
C# Code:
this.ctlTran1.ExecuteDeleg
{
PUT HERE THE CODE TO EXECUTE
};
This works fine to me. I'm sorry if I wasn't clear enough when writing the question.
Thanks Guys for trying to help. I really appreciate it!
Happy New Year to you all
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.