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

[Solved] Grid row action "Delete" ist rendered wrong

1 Answer 86 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.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 14 May 2010, 04:09 PM
As a result of this code, the Delete Button is rendered with the wrong action, namely the Index Action (which is the action of the View) plus an ID, which makes not sense whatsoever (Index has no id).
See attachment for the rendered button.
Html.Telerik().Grid<WorkitemTableRowPattern>() 
        .BindTo(Model.rows) 
        .Name("WorkitemGrid"
        .Localizable("de-DE"//ToDo Culture allgemein ersetzen 
        //.ToolBar(tb => {  
        //    tb.Insert(); 
        //}) 
        .DataBinding(b => b.Ajax() 
            .Select<WorkitemController>(sc => sc.AjaxGridSelect(Model.fatherKey)) 
            .Delete<WorkitemController>(sc => sc.AjaxGridDelete(String.Empty)) // Parameter is added by Grid engine 
            .Insert<WorkitemController>(sc => sc.AjaxGridInsert()) 
            .Update<WorkitemController>(sc => sc.AjaxGridUpdate(String.Empty)) // Parameter is added by Grid engine 
        )  
        .DataKeys(k => k.Add(r => r.workitem.RowKey)) 
        .Columns(c => 
        { 
            c.Command(s => 
            { 
            //    s.Select();  
                //s.Edit();   
                s.Delete();  
            }).Width(300); 
            c.Bound(r => r.workitem.Title); 
            if (Model.viewSprints) c.Bound(s => s.SprintTitle);       
            c.Bound(r => r.workitem.RemainingDays).Format("{0}").Width(15).Title("Rem. Days"); 
            c.Bound(r => r.workitem.RemainingHours).Format("{0}").Width(15).Title("Rem. Hours"); 
            c.Bound(r => r.workitem.FreeRemainingDays).Format("{0}").ReadOnly(true).Width(15).Title("Free Rem. Days"); 
            c.Bound(r => r.workitem.FreeRemainingHours).Format("{0}").ReadOnly(true).Width(15).Title("Free Rem. Hours"); 
            c.Bound(r => r.workitem.Urgent); 
            c.Bound(r => r.workitem.Important); 
            c.Bound(r => r.workitem.Status); 
        }) 
        .Sortable() 
        .Pageable() 
        .Groupable() 
        .Filterable() 
        .Render(); 

1 Answer, 1 is accepted

Sort by
0
Frank Michael
Top achievements
Rank 1
answered on 15 May 2010, 11:36 AM
Solution: See http://www.telerik.com/community/forums/aspnet-mvc/grid/grid-row-action-edit-leads-to-null-pointer-exception.aspx

The error seemingly is a very strange side effect of the problem described there.


Tags
Grid
Asked by
Frank Michael
Top achievements
Rank 1
Answers by
Frank Michael
Top achievements
Rank 1
Share this question
or