Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Call event handler programatically

Reply
Thread Tools

Call event handler programatically

 
 
mg
Guest
Posts: n/a
 
      11-28-2003
How can I call an event handler (e.g., Button1_Click)
programmatically. That is, without having to click on the
button with the mouse.
 
Reply With Quote
 
 
 
 
mg
Guest
Posts: n/a
 
      11-28-2003
That's with C# in the code behind of a WebForm


>-----Original Message-----
>How can I call an event handler (e.g., Button1_Click)
>programmatically. That is, without having to click on

the
>button with the mouse.
>.
>

 
Reply With Quote
 
 
 
 
Frank Oquendo
Guest
Posts: n/a
 
      11-28-2003
mg wrote:
> How can I call an event handler (e.g., Button1_Click)
> programmatically. That is, without having to click on the
> button with the mouse.


It's just a method like any other. So long as you pass the correct
number and type of parameters, you're free to call it any time you like.

Personally, I tend to code such that my event handlers pass their
arguments to a different routine. I do so for just this sort of
situation.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)


 
Reply With Quote
 
mg
Guest
Posts: n/a
 
      11-28-2003
I've tried Button1_Click(null, null) and a few other
arguments when calling Button1_Click from within some
other method in the code behind ... but can't get the "do
something here" code to run. Can you give me something
more specific on how the Button1_Click method can be
called?


private void Button1_Click(object sender,
System.EventArgs e)
{
// do something here
}

Thanks!

>-----Original Message-----
>mg wrote:
>> How can I call an event handler (e.g., Button1_Click)
>> programmatically. That is, without having to click on

the
>> button with the mouse.

>
>It's just a method like any other. So long as you pass

the correct
>number and type of parameters, you're free to call it

any time you like.
>
>Personally, I tend to code such that my event handlers

pass their
>arguments to a different routine. I do so for just this

sort of
>situation.
>
>--
>There are 10 kinds of people. Those who understand

binary and those who
>don't.
>
>http://code.acadx.com
>(Pull the pin to reply)
>
>
>.
>

 
Reply With Quote
 
Frank Oquendo
Guest
Posts: n/a
 
      11-29-2003
mg wrote:
> I've tried Button1_Click(null, null)


Have you tried Button1_Click(this, new EventArgs())?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)


 
Reply With Quote
 
mg
Guest
Posts: n/a
 
      11-29-2003
I've misrepresented my problem

I'll now post a new message with a restatement of the
problem.


>-----Original Message-----
>I've tried Button1_Click(null, null) and a few other
>arguments when calling Button1_Click from within some
>other method in the code behind ... but can't get

the "do
>something here" code to run. Can you give me something
>more specific on how the Button1_Click method can be
>called?
>
>
>private void Button1_Click(object sender,
>System.EventArgs e)
>{
> // do something here
>}
>
>Thanks!
>
>>-----Original Message-----
>>mg wrote:
>>> How can I call an event handler (e.g., Button1_Click)
>>> programmatically. That is, without having to click on

>the
>>> button with the mouse.

>>
>>It's just a method like any other. So long as you pass

>the correct
>>number and type of parameters, you're free to call it

>any time you like.
>>
>>Personally, I tend to code such that my event handlers

>pass their
>>arguments to a different routine. I do so for just this

>sort of
>>situation.
>>
>>--
>>There are 10 kinds of people. Those who understand

>binary and those who
>>don't.
>>
>>http://code.acadx.com
>>(Pull the pin to reply)
>>
>>
>>.
>>

>.
>

 
Reply With Quote
 
Onur Gorur
Guest
Posts: n/a
 
      11-30-2003
MG,

If you want to raise the event programatically use

RaiseEvent(button1.click) function!. (refer help on use

if you want to add a function in run time then use

addhandler a.click, addressof b

where a is control, b is your handler function

Onur



"mg" <(E-Mail Removed)> wrote in message
news:910e01c3b606$031a7370$(E-Mail Removed)...
> How can I call an event handler (e.g., Button1_Click)
> programmatically. That is, without having to click on the
> button with the mouse.



 
Reply With Quote
 
Jackie foster
Guest
Posts: n/a
 
      08-03-2006
try this wonderful vitamin I HAD CARPAL TUNNEL IN BOTH MY HANDS I TRY THE VITAMINS AND I TELL I HAVE NO MORE PROBLEMS SO TRY IT YOU WILL BE HAPPY

From http://search.yahoo.com/search?ei=UT...of+other+peopl

Posted via DevelopmentNow.com Group
http://www.developmentnow.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoke event handler programatically mg ASP .Net 2 01-07-2009 11:48 AM
Event Handler that creates adds another event handler kaczmar2@gmail.com ASP .Net 1 02-22-2007 07:37 AM
Call an event handler programatically =?Utf-8?B?RWQgQ2hpdQ==?= ASP .Net 3 09-13-2005 06:06 PM
Programatically setting OnClick handler for asp:Button (how to do?) Richard Morse ASP .Net 3 02-07-2004 04:04 AM
Invoke event handler programatically mg ASP .Net Web Controls 0 07-15-2003 11:17 AM



Advertisments