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

Not able to delete first record in Grid using Command.Destroy()

4 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ratna
Top achievements
Rank 1
Ratna asked on 06 Aug 2012, 06:31 AM
Hi,

I was able to delete records using below code but not the first record on the grid. Looking at the html in firebug, I found out that for the first row's delete button is directly in the div tag and missing the form tag that has the action. Although, I have provided enough width for the last column, the command buttons are stacked. (Check in the attached display screen). Thanks in advance for any help.

@(Html.Kendo().Grid(Model)       
        .Name("Grid")
        .HtmlAttributes(new { @style = "width:500px;" })
                    .Editable(editable => editable.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(true)
                        .TemplateName("Grid")
                        .Window(w => w.Title("Product")                     
                        .Name("grdWindow")
                        .Animation(true)
                        .HtmlAttributes(new { @style = "width:500px;" }).Modal(true)))
        .Columns(column =>
        {
            column.Bound(p => p.ProductID).Width(120);
            column.Bound(p => p.ProductName).Width(200);
            column.Bound(p => p.Color).Width(120);
            column.Command(command => { command.Edit(); command.Destroy(); }).Width(420);
        })
            .Pageable(pager => pager.PageSizes(true).PreviousNext(true ))           
            .Sortable()
            .Selectable()           
            .DataSource(datasource => datasource
                .Server().PageSize(5)
                .Update("EditProduct", "Home")           
                .Destroy("DeleteProduct", "Home")               
                .Model(model => model.Id(p => p.ProductID))
            )
            )

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 06 Aug 2012, 07:02 AM
Hello Ratna,

We are unable to reproduce this behavior with your Grid setup in the demos distributed with the release. It will be best if you provide us with runnable sample replicating the behavior in order to assist you further.

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ratna
Top achievements
Rank 1
answered on 06 Aug 2012, 04:34 PM
Hi,

I have uploaded zipped demo project here (since it was bigger than 2MB): https://www.dropbox.com/sh/vgzkwnqzxojsv1x/_GSbGICs1D

Thanks,
Ratna
0
Accepted
Nikolay Rusev
Telerik team
answered on 07 Aug 2012, 07:53 AM
Hello Ratna,

If you inspect the response served from server you will notice that form element wraps all delete buttons. However as the grid is also wrapped in form element this results in nested forms which is invalid html.

You shouldn't wrap the grid in form as it will generate forms for its delete actions, over it's editor etc.

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ratna
Top achievements
Rank 1
answered on 07 Aug 2012, 02:15 PM
Thank you. It worked now.
Tags
Grid
Asked by
Ratna
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Ratna
Top achievements
Rank 1
Share this question
or