call a click event

  • Thread starter Thread starter interuser
  • Start date Start date
I

interuser

Hi
In the lbtnSubmit1_Click, lbtnSubmit2_Click , lbtnSubmit3_Click ,etc
of my .aspx form , I want to store the sender in the session , so I
can call again the click method at some other point X in the code. At
point X, I just want to call something like sender.click.

How can I do that?
 
Hi
In the lbtnSubmit1_Click, lbtnSubmit2_Click , lbtnSubmit3_Click ,etc
of my .aspx form , I want to store the sender in the session , so I
can call again the click method at some other point X in the code. At
point X, I just want to call something like sender.click.

How can I do that?

Why do you want to put the sender into Session? Do you need to access it on
another page?

If you just want to use it on the same page, you can use a delegate:

public class MyPage : System.Web.UI.Page
{
...
private EventHandler currentClickEvent;
...
private void btnSubmit1_Click(object sender, EventArgs e)
{
...
currentClickEvent = new EventHandler(btnSubmit1_Click);
}

// Same for the other two Click handlers
...
private void SomeLaterMethod()
{
currentClickEvent();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top