2

I am using Telerik MVC Extensions Grid control, with AJAX binding, and run a delete command. Deletion works as intended, and the grid updates so that it doesn't show the deleted row.

However, after deleting one of the grid columns (the first one) shows up empty. There is also difference in the second column - 'false' instead of the unchecked box. Any ideas why, and how do I fix that?

I can refresh the screen, and that fixes the view. But it is a heavy page, and I'd rather not do the second refresh.

Delete first row:

After deleting, the first column shows up empty: Now first column is empty:

My grid:

Html.Telerik()
    .Grid(Model)
    .Name("scenarioGrid")
    .DataBinding(dataBinding => dataBinding.Ajax()
                                    .Delete("Delete", "Scenario"))
    .DataKeys(keys => keys.Add(c => c.Id))
    .Columns(columns =>
        {
            columns.Template(o => Html.ActionLink(o.Name, "Index", new {id = o.Name})).Title("Scenario")
                .FooterTemplate(@<text>Total @Model.Count() </text>);
            columns.Bound(o => o.IsLocked);
            columns.Bound(o => o.ContractMonth);
            columns.Bound(o => o.CreateDate);
            columns.Command(commands => commands.Delete().ButtonType(GridButtonType.Image)).Title("Delete");
        }
    )
    .Sortable()
    .Scrollable(scroll => scroll.Height(200))
    .ClientEvents(events => events.OnDelete("onDelete").OnComplete("afterDelete"))

2 Answers 2

1

You shouldn't use columns.Template with Ajax binding. It's meant for server side bound grids. You should use

columns.Bound(o => 0.whatever).ClientTemplate("convert your link to a string here");
Sign up to request clarification or add additional context in comments.

2 Comments

Can you help with syntax for client template?
@jprusakova I'm sure someone here can. Just add a question with what you're having trouble with. Chances are, it will get resolved for you:)
1

It looks like you are using server binding to load the grid, but ajax binding to update it. columns.Template is used for server binding. You should use ClientTemplate for ajax binding.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.