This question is locked. New answers and comments are not allowed.
Hi,
I use a custom command to add functionnality to my grid. I want to perform some client validations before execute the command logic.
If the validation fails, I want to cancel the event.
I use "e.preventDefault()" to cancel the event. It works on IE 9.0, but not on IE 8.0 or below ...
Is it a bug or I don't use the right thing ?
Thanks !
I use a custom command to add functionnality to my grid. I want to perform some client validations before execute the command logic.
If the validation fails, I want to cancel the event.
function Grid_onCommand(e) { if (e.name == "desactivation") { var rep = false; var estActif = e.dataItem.EstActif; if (estActif) { rep = confirm("Question 2 ?"); } else { rep = confirm("Question 1 ?"); } if (!rep) { e.preventDefault(); } } }I use "e.preventDefault()" to cancel the event. It works on IE 9.0, but not on IE 8.0 or below ...
Is it a bug or I don't use the right thing ?
Thanks !
4 Answers, 1 is accepted
0
Hi Matthieu,
I was unable to replicate the problem you described. Could you please send us a sample project which reproduces it so we can check what causes it.
All the best,
Petur Subev
the Telerik team
I was unable to replicate the problem you described. Could you please send us a sample project which reproduces it so we can check what causes it.
All the best,
Petur Subev
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
0
Matthieu
Top achievements
Rank 1
answered on 25 Jan 2012, 03:42 PM
Hi Petur,
I use the version 2011.3.1115.340 for my tests.
I can't send you all the code, but I simply use a custom command in my grid :
I add a Javascript function :
On all browser, my code reaches "e.preventDefault()". In IE 9, the command is cancelled. But in IE 8, the command isn't cancelled and my controller action is executed, even if "e.preventDefault()" was called ...
Thanks,
Matthieu
I use the version 2011.3.1115.340 for my tests.
I can't send you all the code, but I simply use a custom command in my grid :
.ClientEvents(events => { events.OnComplete("Grid_onComplete"); events.OnEdit("Grid_onEdit"); events.OnDataBound("Grid_onDataBound"); events.OnRowDataBound("Grid_onRowDataBound"); events.OnCommand("Grid_onCommand"); events.OnError("Grid_onError"); })commands.Custom("desactivation") .ButtonType(GridButtonType.Text) .Text("Activer/Désactiver") .Ajax(true) .Action("_ActiverDesactiverValeurCode", "DomaineValeurs");I add a Javascript function :
function Grid_onCommand(e) { if (e.name == "desactivation") { var rep = false; var estActif = e.dataItem.EstActif; if (estActif) { rep = confirm("Question 2 ?"); } else { rep = confirm("Question 1 ?"); } if (!rep) { e.preventDefault(); } } }On all browser, my code reaches "e.preventDefault()". In IE 9, the command is cancelled. But in IE 8, the command isn't cancelled and my controller action is executed, even if "e.preventDefault()" was called ...
Thanks,
Matthieu
0
Hello again Matthieu,
As I replied in my previous post I was unable to reproduce the problem.
I would like to ask you to check the attached project if I missed something, on my side everything works as expected and the controller is never reached. If the setup needed to reproduce is not complete please modify the project and send it back so we can check what causes it.
Also you did not mention what kind of custom command you use, toolbar or column ?
Does the problem occur using the latest version of the extensions ?
Kind regards,
Petur Subev
the Telerik team
As I replied in my previous post I was unable to reproduce the problem.
I would like to ask you to check the attached project if I missed something, on my side everything works as expected and the controller is never reached. If the setup needed to reproduce is not complete please modify the project and send it back so we can check what causes it.
Also you did not mention what kind of custom command you use, toolbar or column ?
Does the problem occur using the latest version of the extensions ?
Kind regards,
Petur Subev
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
0
Matthieu
Top achievements
Rank 1
answered on 26 Jan 2012, 08:07 PM
Hi Petur,
I try your sample and it works ... I can't figure out what it causes this issue.
I use the same version and I use a custom column command. I'll keep looking for a solution
Thanks for your help !
Matt
I try your sample and it works ... I can't figure out what it causes this issue.
I use the same version and I use a custom column command. I'll keep looking for a solution
Thanks for your help !
Matt