[RESOLVED]page does not refresh after the update AjaxOptions

Ive this partial View which after update should refresh but it won’t happen the message does not appear I tried with alert but It actually doesn’t get their

@using (Ajax.BeginForm("Edit", "Warranty", new { id = Request.QueryString["id"] },
                           new AjaxOptions
                               {
                                   HttpMethod = "post",
                                   UpdateTargetId = "cntr-form",
                                   OnComplete = "OnAjaxResponse(xhr, status, 'Person')",
                                   OnSuccess = "OnAjaxResponse(xhr, status, 'Person'),refreshonUpdate()", //this is refresh
                                   OnFailure = "OnAjaxResponse(xhr, status, 'Person')",
                                   LoadingElementId = "loading-cntr"
                               },
                           new { id = "updateWarrantyForm" }
        ))

and this is where I’m calling this function

    function refreshonUpdate() {
        var tabStrip = $("#tabstrip").data().kendoTabStrip;
        var item0 = tabStrip.items()[0];
        tabStrip.reload(item0);
        alert(tabStrip);
    }

khawaja Atteeq

OnAjaxResponse(xhr, status, 'Person'),refreshonUpdate()"

Try replacing comma with semicolon

OnAjaxResponse(xhr, status, 'Person');refreshonUpdate()"

You have to do it this way:

@using (Ajax.BeginForm("Edit", "Warranty", new { id = Request.QueryString["id"] },
                           new AjaxOptions
                               {
                                   HttpMethod = "post",
                                   UpdateTargetId = "cntr-form",
                                   OnComplete = "refreshonComplete,
                                   OnSuccess = "refreshonUpdate", //this is refresh
                                   OnFailure = "refreshonFailure,
                                   LoadingElementId = "loading-cntr"
                               },
                           new { id = "updateWarrantyForm" }
        ))

and in js:

<script type="text/javascript">

function refreshonUpdate() {
        var tabStrip = $("#tabstrip").data().kendoTabStrip;
        var item0 = tabStrip.items()[0];
        tabStrip.reload(item0);
        alert(tabStrip);
    }

function refreshonComplete() {
        // do something
    }

function refreshonFail() {
        // do something on fail
    }
</script>

Leave a Reply