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

[Solved] Custom command in grid called twice on detail view

2 Answers 185 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.
Faulenzer
Top achievements
Rank 1
Faulenzer asked on 08 Jan 2012, 11:03 PM
Hi,

On Grid, I add detail DetailView with a Grid that have Commands, commands on Detail grid are called twice when i click on button.
For example my View :
@(Html.Telerik().Grid<GroupePartenaire>()
                    .Name("pagesgrid")
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.IdInt)
                            .Title("Id");
                        columns.Bound(x => x.Title)
                            .Title("Titre");
                        columns.Command(commands => commands
                            .Custom("pagesgrid")
                            .Text("Monter")
                            .DataRouteValues(route => route.Add(o => o.Id).RouteKey("Id"))
                            .Ajax(true)
                            .Action("MonterGroupe", "Partenaires"))
                            .HtmlAttributes(new { style = "text-align: center" });
                    })
                    .DetailView(detailView => detailView.ClientTemplate(                       
                            Html.Telerik().Grid<Partenaire>()
                            .Name("Partenaires_<#= Id #>")
                            .Columns(columns =>
                            {
                                columns.Bound(x => x.IdInt)
                                    .Title("Id");
                                columns.Bound(x => x.Title)
                                    .Title("Nom");
                                columns.Command(commands => commands
                                    .Custom("Partenaires_<#= Id #>")
                                    .Text("Monter")
                                    .DataRouteValues(route => route.Add(o => o.Id).RouteKey("Id"))
                                    .Ajax(true)
                                    .Action("MonterPartenaire", "Partenaires"))
                                    .HtmlAttributes(new { style = "text-align: center" });
                            })
                            .DataBinding(dataBinding => dataBinding.Ajax().Select("ListePartenaires", "Partenaires", new { groupePartenaireId = "<#= Id #>" }))
                            .Pageable()
                            .ClientEvents(events => events.OnCommand("onCommand").OnComplete("onComplete"))
                            .ToHtmlString()))
                    .Pageable(settings => settings.PageSize(20).Position(GridPagerPosition.Both))
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("ListeGroupes", "Partenaires"))
                    .EnableCustomBinding(true))

Action("MonterGroupe", "Partenaires") will be called twice on button click.

The two called are called with same parameters. but sometimes (random mode ?) I have only one call to Controller Method.
Is someone has find this problem and find a solution ?

Version : 2011.3.115 of telerik MVC extensions.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 10 Jan 2012, 10:42 AM
Hello Faulenzer,


Thank you for drawing our attention to this issue. I attached a hot-fix build which should fix the problem.
If you use the telerik.grid.min.js from the uploaded archive into your project everything should work fine.
I have also updated your account points.

Greetings,
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
Faulenzer
Top achievements
Rank 1
answered on 10 Jan 2012, 06:48 PM
It works !

Thanks.
Tags
Grid
Asked by
Faulenzer
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Faulenzer
Top achievements
Rank 1
Share this question
or