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

[Solved] Delete command broke grid/strange things are happening

1 Answer 26 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.
Vincent
Top achievements
Rank 1
Vincent asked on 08 Aug 2012, 02:39 PM
Hi everyone,

First, sorry for my "not that great" english, i'm french.

I have a grid, a dropdownlist and a submit button on a page. (see capture 1)

When we click on "Add", it add the selected item of the dropdownlist to a List<string> which the grid is bound to. 
Easy enough. Actually, it owrk weel.

BUT.

I need to put a "delete" column so the user can delete rows.
This is where the problem punch my face.
When we click on Add, strange things is happening. (see capture 2)

the problem might be because my controls are in a table in a div but I don't know why it would be a problem.

This is my code in my view:
<div class="panel">
        <table>
            <tr>
                <td>
                    @(Html.Telerik().Grid(Model.getFPYOperation())
                        .Name("FPYOp")
                        .DataKeys(keys => keys.Add(c => c.OpDesc).RouteKey("opDesc"))
                        .DataBinding(binding => binding.Ajax()
                            .Delete("_DeleteFPYRow", "Production"))
                        .Columns(columns =>
                        {
                            columns.Bound(o => o.OpDesc).Title("FPY Operation").Width(500);
                            columns.Command(commands => commands.Delete()).Width(50);
                        })
                        .Footer(false))
                </td>
                <td>
                    @(Html.Telerik().DropDownListFor(x => x.OperationToAdd)
                        .BindTo(new SelectList(Model.getListOperation(), "OpDesc", "OpDesc"))
                        .HtmlAttributes(new { style = string.Format("width:200px;") })
                        .SelectedIndex(0))
                </td>
                <td>
                    <input type="submit" value="add" />
                </td>
            </tr>
        </table>
    </div>

When I dont put the "columns.Command(commands => commands.Delete()).Width(50); " , every thing works fine.
WHAT THE F... IS HAPPENING

it seems like a new div is created, an other delete button and the"add" button is no more bound to any action.

Thank you for the help! :)

1 Answer, 1 is accepted

Sort by
0
Vincent
Top achievements
Rank 1
answered on 08 Aug 2012, 03:40 PM
Wow! I just find out that if I put a "Select" command, it works well. Is there something I don't know about the Delete command?
Tags
Grid
Asked by
Vincent
Top achievements
Rank 1
Answers by
Vincent
Top achievements
Rank 1
Share this question
or