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

[Solved] Custom column button in master/detail grid

0 Answers 128 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.
Enrico
Top achievements
Rank 1
Enrico asked on 09 Aug 2012, 01:41 PM
Hi everybody,

I have a very well working master/detail grid for showing companies/contacts information. In the detail grid I have a column button, that should delete the entry identified by 1. the ID of the master grid and 2. the row of the detail grid from a database table. The problem is, that in detail view the value of the expression <#= ID #> (which normally gives the ID of my master) seems to be replaced by the detail ID (selected row in detail).

Here is the code of this button definition:

.Columns(columns =>
{
    columns.Command(commands =>
    {
        commands.Edit().ButtonType(GridButtonType.Image);
        commands.Delete().ButtonType(GridButtonType.Image);
        commands
            .Custom("removeContact")
            .Text("Zuordnung löschen")
            .DataRouteValues(route =>
            {
                route.Add(c => c.ID).RouteKey("ContactID");
            })
            .Ajax(true)
            .Action("ContactsDeleteReference", "Companies", new { CompanyID = "<#= ID #>" })
            .HtmlAttributes(new { style = "text-align: center" }
        );
    }).Width(210);
})

Am I missing something or has anyone a solution?

Regards

Enrico
Tags
Grid
Asked by
Enrico
Top achievements
Rank 1
Share this question
or