Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Confirm Deletion via WebNavBar

Last post 05-12-2008 4:47 by [Infragistics] Nikola Genov. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-23-2008 14:21

    • clalande
    • Not Ranked
    • Joined on 04-23-2008
    • Points 20

    Confirm Deletion via WebNavBar

    I have an UltraWebGrid with data in it, a WebNavBar displaying the add and delete buttons, and they are tied togeather by the GridID.

    I want to add a client side confirmation message before the delete event executes.  The add and delete events work fine. Whatever I seem to do, the page still posts back and the row delete event fires, even when the user declines the confirmation.

    The actual deletion is handled by a server side delete row event:

    this.uwgWorkflowDetails.DeleteRow +=new DeleteRowEventHandler(uwgWorkflowDetails_DeleteRow);

    private void uwgWorkflowDetails_DeleteRow(object sender, RowEventArgs e)
    {
       decimal strId = Convert.ToDecimal(e.Row.Cells.FromKey(SfaWorkflowDTLDisplaySetDCFields.PrimaryKeyFieldName).Value);

       [call to database deletion method]

     }

    I have set up a clent side event:

    wnbWorkflowDetails.ClientSideEvents.BeforeDeleteRow = "BeforeRowDeleted";  (where wbnWorkflowDetails is the web nav bar)

    And registered the script block in the page:

    function BeforeRowDeleted(oNavBar, oButton, oEvent)
    {
    if(confirm('ÀÀréé yóóüü sure you wíísh to delete?'))
    {
    oEvent.needPostBack = true;
    return false;
    }
    else
    {
    oEvent.needPostBack = false;
    return true;
    }
    }

    The client side event fires, and the confirmation box is displayed, but with either response the row is deleted.

    Filed under: ,
    • Post Points: 20
  • 05-12-2008 4:47 In reply to

    Re: Confirm Deletion via WebNavBar

    You need to modify BeforeRowDeleted that way:

    function BeforeRowDeleted(oNavBar, oButton, oEvent)
    {
        oEvent.cancel = !confirm(
    'delete?');
    }

    Best,
    Nick

    Best Regards,
    Nikola Genov
    The Infragistics ASP .NET Team
    Filed under: , ,
    • Post Points: 5
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems