aspnet confirmation from Client

Discussion in 'ASP .Net' started by sweetpotatop@yahoo.com, Sep 21, 2007.

  1. Guest

    Hi,

    I have a page written in C# asp.net, which allow users to select and
    delete records.

    Once user selects the record to be deleted, I will confirm with the
    user, something like "Are you sure you want to delete the selected
    records?"

    If yes, I will go and delete the record from SQL. How can this
    confirmation and deleting process be done?

    >From what I understand, I need javascript to confirm with the user,

    but then how can I transfer the response back to the server and delete
    those selected records from the server?

    Thanks in advance. Your advice and help would be greatly appreciated.
     
    , Sep 21, 2007
    #1
    1. Advertising

  2. <> wrote in message
    news:...

    > I have a page written in C# asp.net, which allow users to select and
    > delete records.


    How are the records presented to the user?

    > Once user selects the record to be deleted, I will confirm with the
    > user, something like "Are you sure you want to delete the selected
    > records?"
    >
    > If yes, I will go and delete the record from SQL. How can this
    > confirmation and deleting process be done?


    <asp:Button ID="MyButton" runat="server" Text="Delete"
    OnClick="MyButton_Click" OnClientClick="return confirm('Are you sure you
    want to delete this record?');" />

    >>From what I understand, I need javascript to confirm with the user,

    > but then how can I transfer the response back to the server and delete
    > those selected records from the server?


    That's what a postback is for... When the user clicks the above button, a
    JavaScript alert will ask them to confirm that they want to continue. If
    they don't, nothing further will happen. If they do, the server-side
    MyButton_Click event will fire - that's where you write the code to delete
    the record...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Sep 21, 2007
    #2
    1. Advertising

  3. Guest

    On Sep 21, 12:35 pm, "Mark Rae [MVP]" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > I have a page written in C# asp.net, which allow users to select and
    > > delete records.

    >
    > How are the records presented to the user?
    >
    > > Once user selects the record to be deleted, I will confirm with the
    > > user, something like "Are you sure you want to delete the selected
    > > records?"

    >
    > > If yes, I will go and delete the record from SQL. How can this
    > > confirmation and deleting process be done?

    >
    > <asp:Button ID="MyButton" runat="server" Text="Delete"
    > OnClick="MyButton_Click" OnClientClick="return confirm('Are you sure you
    > want to delete this record?');" />
    >
    > >>From what I understand, I need javascript to confirm with the user,

    > > but then how can I transfer the response back to the server and delete
    > > those selected records from the server?

    >
    > That's what a postback is for... When the user clicks the above button, a
    > JavaScript alert will ask them to confirm that they want to continue. If
    > they don't, nothing further will happen. If they do, the server-side
    > MyButton_Click event will fire - that's where you write the code to delete
    > the record...
    >
    > --
    > Mark Rae
    > ASP.NET MVPhttp://www.markrae.net


    The button is setup in the way that you described above. But how do I
    get the return value from the server side? What variable does the
    return value go?
     
    , Sep 21, 2007
    #3
  4. <> wrote in message
    news:...

    > The button is setup in the way that you described above. But how do I
    > get the return value from the server side? What variable does the
    > return value go?


    What return value are you talking about...?


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Sep 21, 2007
    #4
  5. Guest

    On Sep 21, 1:45 pm, "Mark Rae [MVP]" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > The button is setup in the way that you described above. But how do I
    > > get the return value from the server side? What variable does the
    > > return value go?

    >
    > What return value are you talking about...?
    >
    > --
    > Mark Rae
    > ASP.NET MVPhttp://www.markrae.net


    Return value is the actual response from the user, e.g "Yes" to
    delete , or "No" (client-side respond)

    Since I am going to delete the record from the server-side, is there a
    server-side variable that capture the respond from the user (client-
    side)?
     
    , Sep 21, 2007
    #5
  6. <> wrote in message
    news:...

    > Return value is the actual response from the user, e.g "Yes" to
    > delete , or "No" (client-side respond)


    OnClientClick="return confirm('Are you sure...?');

    Note the word "return" before "confirm"...

    > Since I am going to delete the record from the server-side, is there a
    > server-side variable that capture the respond from the user (client-
    > side)?


    None is needed - if the user chooses not to continue, the postback doesn't
    happen...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Sep 21, 2007
    #6
    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. angus

    client confirmation in asp.net

    angus, Jun 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    427
    angus
    Jun 24, 2004
  2. Gary Nelson

    Upgrade from aspnet 1.1 to aspnet 2.0

    Gary Nelson, Oct 14, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    528
    Gary Nelson
    Oct 14, 2005
  3. Replies:
    7
    Views:
    711
    Juan T. Llibre
    Mar 23, 2007
  4. Brian Schuth
    Replies:
    0
    Views:
    317
    Brian Schuth
    Sep 8, 2003
  5. Alfred Sehmueller
    Replies:
    0
    Views:
    309
    Alfred Sehmueller
    Feb 20, 2004
Loading...

Share This Page