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

[Solved] Multiple UpdateCommand

4 Answers 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santos
Top achievements
Rank 1
Santos asked on 11 Apr 2013, 09:32 AM
Hello friends:

My problem is that i have two editing modes in a grid, the two have to call to updateCommand but the first button have to execute one method and the second buttom execute other method.

in the itemCommand i have this code:

if (e.CommandName == "Desasignar")
                {
                    //la condicion indica que si el campo fecha_baja esta vacio se ejecute la linea, si no ya esta dado de baja
                    if (item.Cells[9].Text == " ")
                        (item as GridEditableItem).FireCommandEvent(RadGrid.EditCommandName, "Desasignar");
                }
                if (e.CommandName == "EliminarDispositivo")
                {
                    //la condicion indica que si el campo fecha_baja esta vacio se ejecute la linea, si no ya esta dado de baja
                    if (item.Cells[9].Text == " ")
                        (item as GridEditableItem).FireCommandEvent(RadGrid.EditCommandName, "EliminarDispositivo");
                }

and the UpdateCommand code:

//Si el argumento es desasignar
if(e.CommandArgument == "Desasignar")
{
        .......
}
 
//Si el argumento es Eliminar el dispositivo
if (e.CommandArgument == "EliminarDispositivo")
{
          .......
}


then, in the updateCommand, e.CommandArgument = ""; and i need distinguish the buttom 

Thanks for the help!!

4 Answers, 1 is accepted

Sort by
0
Santos
Top achievements
Rank 1
answered on 15 Apr 2013, 04:32 PM
Nobody can help me?
0
Eyup
Telerik team
answered on 16 Apr 2013, 10:00 AM
Hi Santos,

Please note that if you want to fire an Update command, you will have to use:
RadGrid.UpdateCommandName
instead of:
RadGrid.EditCommandName

Hope this helps. Additionally, you can check out the following topics which explain how to fire commands both on server and client side:
http://www.telerik.com/help/aspnet-ajax/grid-fire-command-event-from-code.html
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html

Regards,
Eyup
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Santos
Top achievements
Rank 1
answered on 16 Apr 2013, 04:13 PM
Yes, I use the UpdateComand but my problem is that i don't know how send the commandName of the button to UpdateComand event

My grid have 2 update Buttons and i need diferent commandName to the buttons.
then, the 2 buttons call to editCommand and the grid is in edit mode, but when i confirm the changes of the row, i call to UpdateComand but y don't know what button press.


Sorry my English and thanks for your help!!
0
Eyup
Telerik team
answered on 19 Apr 2013, 08:20 AM
Hi Santos,

When you are passing your arguments upon firing Edit commands, they will be available on ItemCommand event for the Edit command name, not for Update command name or the Update event.

To achieve the described requirement, you can use a ViewState variable. I have prepared a sample RadGrid web site to demonstrate how you can accomplish that. Please check out the attached application and let me know if it helps you.

Greetings,
Eyup
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Santos
Top achievements
Rank 1
Answers by
Santos
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or