How to Post back page from Client side code?

Discussion in 'ASP .Net Building Controls' started by Ahmad Jalil Qarshi, Oct 26, 2005.

  1. Hi,

    I am developing a website in ASP.NET. I want to have a client side code to
    confirm the deletion of some information from backend database. I want to
    use a Message Box have two buttons "Yes" and "No" to confirm the deletion.

    Now I want if the user press "Yes" the page should be posted back to the
    server to delete the information from database and do nothing when user
    press "No" button means don't post back the page.

    Anybody there to help me.

    with best Regards,


    Ahmad Jalil Qarshi
     
    Ahmad Jalil Qarshi, Oct 26, 2005
    #1
    1. Advertising

  2. Use __doPostBack(<eventTarget>,<eventArgument>)...
     
    Tasos Vogiatzoglou, Oct 26, 2005
    #2
    1. Advertising

  3. Ahmad Jalil Qarshi

    Onin Tayson Guest

    You can add an onClick attribute to your Button & handle the confirmation
    using the confirm javascript method.

    On your page load event:

    YourButtonNameHere.Attributes.Add("onclick", "<script>return confirm('Do
    you want to continue deleting the record(s)?');</script>");

    That's all there is to it!


    "Ahmad Jalil Qarshi" <> wrote in message
    news:...
    > Hi,
    >
    > I am developing a website in ASP.NET. I want to have a client side code to
    > confirm the deletion of some information from backend database. I want to
    > use a Message Box have two buttons "Yes" and "No" to confirm the deletion.
    >
    > Now I want if the user press "Yes" the page should be posted back to the
    > server to delete the information from database and do nothing when user
    > press "No" button means don't post back the page.
    >
    > Anybody there to help me.
    >
    > with best Regards,
    >
    >
    > Ahmad Jalil Qarshi
    >
     
    Onin Tayson, Oct 26, 2005
    #3
  4. Ahmad Jalil Qarshi

    Niraj Ranka Guest

    Hello,

    Please add the javascript function to the onclik event on the button by
    adding hte functioname in the attritubes on the button. like

    buttonname.attributes.add("onclick",functionname)

    And in the functio jsut write
    functionanem
    (
    return confirm('do u want to delete');
    )

    It will work.

    Regards
    --
    Niraj Ranka
    The will to be successfull is waste, unless u have the will to prepare!!!

    "Ahmad Jalil Qarshi" <> wrote in message
    news:...
    > Hi,
    >
    > I am developing a website in ASP.NET. I want to have a client side code to
    > confirm the deletion of some information from backend database. I want to
    > use a Message Box have two buttons "Yes" and "No" to confirm the deletion.
    >
    > Now I want if the user press "Yes" the page should be posted back to the
    > server to delete the information from database and do nothing when user
    > press "No" button means don't post back the page.
    >
    > Anybody there to help me.
    >
    > with best Regards,
    >
    >
    > Ahmad Jalil Qarshi
    >
     
    Niraj Ranka, Oct 26, 2005
    #4
    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. Joby
    Replies:
    0
    Views:
    1,646
  2. nick
    Replies:
    3
    Views:
    3,221
    Eliyahu Goldin
    Dec 15, 2004
  3. Ahmad Jalil Qarshi

    How to Post back page from Client side code?

    Ahmad Jalil Qarshi, Oct 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    632
    Niraj Ranka
    Oct 26, 2005
  4. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    796
    Masudur
    May 25, 2007
  5. Bogdan
    Replies:
    2
    Views:
    670
    Bogdan
    Jun 9, 2008
Loading...

Share This Page