Simulation of Button click

  • Thread starter Thread starter mg
  • Start date Start date
M

mg

I have a WebForm with C# and JavaScript functions -

The aspx file holds two buttons: Button1 and Button2

In Page_Load (code behind), I have Button2.Attributes.Add
("onclick", "func()");

My program works if I first press Button1 with the mouse
and then press Button2 with the mouse.

I'd like to run the same program by physically pressing
only Button1.

I'd like the code in the event handler of Button1 to run
first, then have the (programatic) pressing of Button2
cause the JavaScript function func() to run as a result
of the Button2 "onclick" event.
 
It will be helpful if you could explain your processing flow in greater detail.

1. Are button1 and button2 web controls or html controls?
2. Does button1 and button2 fire server-side event or only client-side event.
3. Why do you need to press button2 to call a javascript function?
Why can't you just call the javascript function directly?

Tommy,
 
Back
Top