Simulation of Button click

Discussion in 'ASP .Net' started by mg, Nov 29, 2003.

  1. mg

    mg Guest

    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.
    mg, Nov 29, 2003
    #1
    1. Advertising

  2. mg

    Teemu Keiski Guest

    Perhaps this thread at ASP.NEt Forums gives you starters:
    http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=406072

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "mg" <> wrote in message
    news:042c01c3b611$76fd8010$...
    > 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.
    >
    >
    Teemu Keiski, Nov 29, 2003
    #2
    1. Advertising

  3. mg

    Tommy Guest

    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" <> wrote in message news:<042c01c3b611$76fd8010$>...
    > 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.
    Tommy, Nov 29, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    829
    Purvi T
    Oct 19, 2004
  2. mike parr
    Replies:
    1
    Views:
    464
    Marina
    May 20, 2004
  3. Ben Fidge
    Replies:
    5
    Views:
    733
    S. Justin Gengo
    Jun 15, 2004
  4. Amy
    Replies:
    0
    Views:
    974
  5. jasperng
    Replies:
    0
    Views:
    1,305
    jasperng
    Nov 27, 2008
Loading...

Share This Page