Asked by:
EventHandler ButtonClick Invoke

Question
-
User1536465747 posted
I have the following code in the user control (.ascx):
public event EventHandler ButtonClick; protected void btnNext_Click(object sender, EventArgs e){ // another code this.ButtonClick?.Invoke(this, e); }
It works but it's terribly slow. Is there a better way to handle this? Thank you
Tuesday, September 18, 2018 4:22 PM
All replies
-
User-893317190 posted
Hi KulerMaster ,
What do you mean by "terribly slow"? Does it refer to the whole code in your btnNex_Click or just your event ButtonClick?
Anyway, you haven't posted the content of your btnNext_Click or ButtonClick. It is hard to consider what causes low performance of your code.
Please post more code which you think causes the problem.
Best regards,
Ackerly Xu
Wednesday, September 19, 2018 2:51 AM -
User1536465747 posted
Nothing much actually. I only set the Session and then Invoke the button click.
Session.Add("blah", true); this.ButtonClick?.Invoke(this, e);
Wednesday, September 19, 2018 11:45 AM -
User475983607 posted
You still have not show the ButtonClick handler code (the delegate) which is probably where the "slowness" is happening.
Wednesday, September 19, 2018 1:33 PM -
User1536465747 posted
It only changes the RadWizard step index. Practically nothing
Wednesday, September 19, 2018 5:32 PM -
User475983607 posted
It only changes the RadWizard step index. Practically nothing
Still, you have not posted the handler code... And we just found out the issue is related to a 3rd party control.
I built a test and there no discernible difference between invoking a click handler or not. Is there anyway you can post code that reproduces the issue, provide the steps to reproduces the issue, and quantify "terribly slow". Have you tried asking the Telerik folks for support?
Wednesday, September 19, 2018 7:31 PM -
User1536465747 posted
Terribly slow means like 5-6 seconds waiting for respond (Uploading (0-100%)
Btw, I really have no clue what code you want me to provide. There is no other code.
Thank you anyway for the try. It's much appreciated.
Saturday, September 22, 2018 10:40 AM -
User475983607 posted
Btw, I really have no clue what code you want me to provide. There is no other code.That's a problem because you posted the following code and stated that it is the source of a 5-6 second slowdown. You must have a reason for posting the code?
public event EventHandler ButtonClick; protected void btnNext_Click(object sender, EventArgs e){ Session.Add("blah", true); this.ButtonClick?.Invoke(this, e); }
The highlighted line invokes a delegate. There is no indication where the delegate is assigned or what code is within the delegate's method block.
Terribly slow means like 5-6 seconds waiting for respond (Uploading (0-100%)You're uploading a file? What are the steps to reproduce? What troubleshooting steps have you tried?
Saturday, September 22, 2018 12:42 PM