How to make a button to have both server side and client event in ASP.NET?

Discussion in 'ASP .Net' started by Lau Alvin, Aug 12, 2004.

  1. Lau Alvin

    Lau Alvin Guest

    HI all ,

    I want to make a button which have a server side OnClick event in .cs to
    update the DB. But I want it to have a client side onclick event to run
    a javascript popup too. And the javascript will be run only in some
    conditions determine by the input of some webcontrols. Finally the
    server side event will depend on the chioce of user in the javascript
    popup.

    How can i achieve it ?

    thX ~

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Lau Alvin, Aug 12, 2004
    #1
    1. Advertising

  2. Lau Alvin

    Mark Rae Guest

    "Lau Alvin" <> wrote in message
    news:%23PvhX$...

    > I want to make a button which have a server side OnClick event in .cs to
    > update the DB. But I want it to have a client side onclick event to run
    > a javascript popup too. And the javascript will be run only in some
    > conditions determine by the input of some webcontrols. Finally the
    > server side event will depend on the chioce of user in the javascript
    > popup.
    >
    > How can i achieve it ?


    I think you're trying to make life difficult for yourself! I would suggest:

    1) The button calls a client-side JavaScript function which loads the popup.

    2) The user makes whatever choices you require in the popup then click an OK
    button when finished.

    3) The OK button in the popup calls a server-side function (or just
    submits!) which updates the database and closes the popup.
     
    Mark Rae, Aug 12, 2004
    #2
    1. Advertising

  3. Lau,

    See if this article helps.

    http://www.developerfusion.com/show/4505/

    Alan


    "Lau Alvin" <> wrote in message
    news:#PvhX$...
    > HI all ,
    >
    > I want to make a button which have a server side OnClick event in .cs to
    > update the DB. But I want it to have a client side onclick event to run
    > a javascript popup too. And the javascript will be run only in some
    > conditions determine by the input of some webcontrols. Finally the
    > server side event will depend on the chioce of user in the javascript
    > popup.
    >
    > How can i achieve it ?
    >
    > thX ~
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Alan Z. Scharf, Aug 12, 2004
    #3
  4. Lau Alvin Lau, Aug 12, 2004
    #4
  5. Lau Alvin

    Karl Guest

    btnId.Attributes.Add("onclick", "ClientSideFunctionName();") and the normal
    way for server-side.

    Karl

    "Lau Alvin Lau" <> wrote in message
    news:...
    >
    > Thx All ~
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Karl, Aug 13, 2004
    #5
    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. =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    Replies:
    2
    Views:
    6,532
    rick74
    May 27, 2008
  2. Fred
    Replies:
    2
    Views:
    1,090
    Craig Deelsnyder
    Jul 12, 2004
  3. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    771
    Kevin Spencer
    Jun 2, 2005
  4. Aymer
    Replies:
    1
    Views:
    401
    Alvin Bruney
    Sep 19, 2003
  5. Guest

    Fire server side event before client side event

    Guest, Mar 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    622
    Ken Cox [Microsoft MVP]
    Mar 18, 2005
Loading...

Share This Page