8 Answers, 1 is accepted
0
Raja
Top achievements
Rank 1
answered on 01 Sep 2011, 09:22 PM
Hi Craig,
Since it is an ajax call. You should use client events on grid. For this you need to implement java script function and wire it with databinding client event on the grid. You can catch errors in your java script function.
Following link will give you more information:
http://demos.telerik.com/aspnet-mvc/grid/clientsideevents
Thanks,
Raja.
Since it is an ajax call. You should use client events on grid. For this you need to implement java script function and wire it with databinding client event on the grid. You can catch errors in your java script function.
Following link will give you more information:
http://demos.telerik.com/aspnet-mvc/grid/clientsideevents
Thanks,
Raja.
0
Craig
Top achievements
Rank 1
answered on 02 Sep 2011, 12:30 PM
Thanks, so I guess I could set a variable in my JSON return that indicates that there is an error and check for that variable in onDataBind method. If there is a better way, let me know.
0
IT
Top achievements
Rank 1
answered on 02 Sep 2011, 01:47 PM
I'm trying to address the same problem.
Returning something with the JSON only covers exceptions that are caught in the controller... if there are any other issues that prevent the controller returning data, the grid will fail silently.
The best place to handle this is probably the OnError client event, but I haven't been able to explore further, as it doesn't work in the current (production) release (see http://www.telerik.com/community/forums/aspnet-mvc/grid/grid-not-validating-all-columns-in-batch-edit-mode.aspx)
(edit)
Re the above reply... I'd be happy for someone to correct/clarify, but I think the DataBinding event fires *before* the request, so can't be used to check for errors. I haven't tested, but I suspect the DataBound event only fires when succesfully bound.
Returning something with the JSON only covers exceptions that are caught in the controller... if there are any other issues that prevent the controller returning data, the grid will fail silently.
The best place to handle this is probably the OnError client event, but I haven't been able to explore further, as it doesn't work in the current (production) release (see http://www.telerik.com/community/forums/aspnet-mvc/grid/grid-not-validating-all-columns-in-batch-edit-mode.aspx)
(edit)
Re the above reply... I'd be happy for someone to correct/clarify, but I think the DataBinding event fires *before* the request, so can't be used to check for errors. I haven't tested, but I suspect the DataBound event only fires when succesfully bound.
0
Craig
Top achievements
Rank 1
answered on 06 Sep 2011, 04:25 PM
Yeh, onError doesn't execute if there is an ajax error. I really wish that there was some simple way to catch ajax errors using Telerik grid, rather than have to set return codes and check those with every single bind.
That's really a big oversight on Telerik's part.
That's really a big oversight on Telerik's part.
0
Hi Craig,
Atanas Korchev
the Telerik team
Could you please suggest how we can improve this behavior in the future?
On a side note there was indeed a problem which prevented the OnError event. This was fixed in the latest internal build. We have also uploaded quite a lot of hotfix builds in other threads.
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
Craig
Top achievements
Rank 1
answered on 07 Sep 2011, 01:15 PM
I will try the internal build and if onError catches ajax errors, that will solve my problem.
0
Craig
Top achievements
Rank 1
answered on 18 Oct 2011, 03:39 PM
How do I avoid the html error popup box from popping up? In ajax, if I catch the error in a error function, the popup doesn't show. I was assuming this would do the same thing.
For example: If I have a 401 error, I don't want the 401 error popup, I want to just redirect to login page.
For example: If I have a 401 error, I don't want the 401 error popup, I want to just redirect to login page.
0
Hello Craig,
Atanas Korchev
the Telerik team
The OnError event should be raised everytime $.ajax raises errors. However there is a known problem in 2011.2 712 which prevents the OnError event from firing. This forum thread contains the hotfix.
Regards,Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now