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

[Solved] Custom command fires twice

1 Answer 95 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.
MICHAEL
Top achievements
Rank 1
MICHAEL asked on 26 Dec 2011, 04:36 PM
I'm trying to create a custom command, the command executes but it post back two times.  Am I doing anything wrong?

my custom command:

commands.Custom("test").ButtonType(GridButtonType.Image).HtmlAttributes(new { @class = "test" })
                                       .Ajax(true)
                                       .Action("CreateTest", "Home")
                                       .DataRouteValues(route =>
                                       {
                                           route.Add(o => o.TestID).RouteKey("testID");
                                       });

controller:

public JsonResult CreateTest(int testID)
{

    return Json(new { string.Empty });
}

I have clientevent for grid for oncomplete:

.ClientEvents(events => events.OnComplete("Grid_onComplete"))


Also javascript for oncomplete:

function Grid_onComplete(e) {

         if (e.name == "createInvoice") {
             alert("Test created");
         }
    }

 



 


1 Answer, 1 is accepted

Sort by
0
binu
Top achievements
Rank 1
answered on 03 Feb 2012, 05:51 PM
Tags
Grid
Asked by
MICHAEL
Top achievements
Rank 1
Answers by
binu
Top achievements
Rank 1
Share this question
or