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.Perhaps this thread at ASP.NEt Forums gives you starters:
http://www.asp.net/Forums/ShowPost...1&PostID=406072
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"mg" <mg@.theworld.com> wrote in message
news:042c01c3b611$76fd8010$a101280a@.phx.gbl...
> 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,
"mg" <mg@.theworld.com> wrote in message news:<042c01c3b611$76fd8010$a101280a@.phx.gbl>...
> 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.
0 comments:
Post a Comment