Calling C# user-defined function in javascript

Discussion in 'ASP .Net' started by =?Utf-8?B?TXBob3ph?=, Aug 6, 2004.

  1. Hi! Programmers,,,,,,

    Scenario
    I have a DataGrid with the delete button, If the user delete the row I'd
    like to show a confirmation dialog box with two buttons(Yes,No). If the user
    click yes the program must call my user-defined function to delete the row
    from database.

    The problem is I do not know how to create a confirm on deletes in a datagrid.

    Can somebody help?


    Thanks
    Mpho
     
    =?Utf-8?B?TXBob3ph?=, Aug 6, 2004
    #1
    1. Advertising

  2. Hi there,

    you have to do this in two steps:
    1. when creating the datagrid, you have to add to Attributes collection of
    the button that will call the delete command onclick ( not the server event,
    but javascript ) that should contains something like

    onclick="return confirmation('Are you really want to do that?');"
    when the user click the button this line will popup a confirmation box. if
    the user clicks No, then the page will not be submited. if the user clicks
    OK the page will submited

    2. you have to create a Delete command event or to create ItemCommand event
    and check which is the command of the button that was pressed

    using this you will know that if the poage is submitted and the .net enters
    in the Command event ( Item or Delete ), the user was accepts the
    confirmation

    Regards
    Martin

    "Mphoza" <> wrote in message
    news:...
    > Hi! Programmers,,,,,,
    >
    > Scenario
    > I have a DataGrid with the delete button, If the user delete the row I'd
    > like to show a confirmation dialog box with two buttons(Yes,No). If the

    user
    > click yes the program must call my user-defined function to delete the row
    > from database.
    >
    > The problem is I do not know how to create a confirm on deletes in a

    datagrid.
    >
    > Can somebody help?
    >
    >
    > Thanks
    > Mpho
    >
     
    Martin Marinov, Aug 6, 2004
    #2
    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. Andreas Lagemann
    Replies:
    8
    Views:
    502
    Mike Wahler
    Jan 10, 2005
  2. tiwy
    Replies:
    0
    Views:
    453
  3. Oodini
    Replies:
    1
    Views:
    1,795
    Keith Thompson
    Sep 27, 2005
  4. Replies:
    1
    Views:
    517
    Sion Arrowsmith
    Jul 10, 2008
  5. Alok
    Replies:
    3
    Views:
    262
Loading...

Share This Page