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

OnPopUpShowing equivalent for EditForms instead of PopUp

3 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Miguel
Top achievements
Rank 1
Miguel asked on 10 Dec 2013, 04:56 PM
In a grid with an edit form when the EditMode="PopUp" the OnPopUpShowing event is available.
I need to have EditMode="EditForms" and i need to run some javascript code before the forms loads.
but it doesn't seem like the OnPopUpShowing works when EditForms is selected. Is there any other settings or work around that i can use?
I haven't been able to find anything, any tips?

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 13 Dec 2013, 03:03 PM
Hi Miguel,

You could use the OnCommand client-side event that is triggered on every grid command. It is triggered before the edit form is opened and before OnPopUpShowing when EditMode is set to PopUp.

In the handler for the event there could be a condition that executes only when the command name is Edit. The handler would look similar to this:

function onCommand(sender, args) {
    if (args.get_commandName() == "Edit") {
        // add custom logic
         
    }
}


Regards,
Viktor Tachev
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Miguel
Top achievements
Rank 1
answered on 13 Dec 2013, 07:08 PM
Viktor thanks for the reply.

I added the OnCommand="onCommand" to the client event.

But its not triggering. I read in the telerik forums that OnCommand is only for client side binding. How correct is that statement?

Thanks for trying.

Miguel.
0
Viktor Tachev
Telerik team
answered on 18 Dec 2013, 12:13 PM
Hello Miguel,

OnCommand event is raised for every command of RadGrid before it is actually triggered. This event could be used to intercept what command is about to be fired and implement some custom logic or cancel the command.

Generally when OnCommand is defined the grid "prepares" for client-side binding. If you use client-side binding you would need to handle the event in order to bind the grid, however it could be used also with server-side binding.

For your convenience I have prepared a sample project where the approach for intercepting the edit command is illustrated. For simplicity only an alert is shown when an Edit button is clicked.

Regards,
Viktor Tachev
Telerik
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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Miguel
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Miguel
Top achievements
Rank 1
Share this question
or