This is a migrated thread and some comments may be shown as answers.

[Solved] Telerik Grid Client Event OnError didn't call the event in IE Only

0 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
USMAN
Top achievements
Rank 2
USMAN asked on 20 Jun 2012, 03:04 PM
Hi,
I am facing a strange problem here, I have uploaded the Telerik MVC application to our dedicated server and when I run the application from any other browser e.g. Google Chrome, FireFox, Safari, It works Fine.
BUT

When I run the same application in IE (Internet Explorer) the Grid's Client Event "OnError" didn't work, it even didn't call the function at all, and it is only happening in IE.

My Grid code in View is 

<%= Html.Telerik().Grid<MyAPP.Models.CategoriesMetaData>()
        .Name("Grid")
         
        .DataKeys(keys =>
        {
            keys.Add(p => p.CategoryID);
        })
        .ToolBar(commands =>
        {
            commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0" });
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Select("_SelectAjaxBinding", "Categories")
                .Insert("_InsertAjaxEditing", "Categories")
                .Update("_SaveAjaxEditing", "Categories")
                .Delete("_DeleteAjaxEditing", "Categories");
             
        })
        .Columns(columns =>
        {
            columns.Bound(p => p.Category).Width(80);
            columns.Bound(p => p.Deleted).ClientTemplate("<# if(Deleted) { #>Yes<# } else {#>No<# } #>").Width(80);
             
             
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Text);
                commands.Delete().ButtonType(GridButtonType.Text);
            }).Width(200).Title("Commands");
        })
            .Editable(editing => editing
                .Mode(GridEditMode.InLine))
                                    .ClientEvents(events => events.OnError("onError").OnEdit("GridOnInsert"))
           .Pageable()
              .Scrollable(s => s.Height(300))
            .Sortable()
            .Filterable()
            .Selectable()
%>

and JQuery Function is

function onError(e) {
 
    $.ajax({
        url: "/Error/getErrorCode",
        data: { id: "test" },
        dataType: "json",
        type: "POST",
        error: function (e) {
            
            alert("An error occurred." + e.responseText);
        },
        success: function (data) {
            // alert("An error occurred." + data.test);
 
            if (data.test == "2601") {
                var windowElement = $('#Window');
                windowElement.data('tWindow').title("Error").content("Data already exists, it must be unique. <br/> <div align='right'> <button id='btnClose' class='t-button' type='button' onclick='javascript:CloseWindow();' >OK</button> </div>").center().open();
            }
         
 
            var mygrid = $('#Grid').data('tGrid');
            mygrid.ajaxRequest();
 
 
        }
    });
    e.preventDefault();
}

OnEdit:


function GridOnInsert(e) {
    var form = e.form;
    var mode = e.mode;
    if (mode == "insert") {
        var del = form.Deleted;
        del.value = false;
    }
}

The onEdit function "GridOnInsert" is working fine in ALL Browsers even it works fine in IE.

But the client event Function "onError" didn't working in IE.

Please suggest any solution for this problem , as it is very urgent.
Tags
Grid
Asked by
USMAN
Top achievements
Rank 2
Share this question
or