Click here to Skip to main content
15,891,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i want to send parameter to action in edit button in keno grid,but i don't haw do it

this is my code:
C#
    @(Html.Kendo().Grid((IEnumerable<Arda.Models.SlideShow>)ViewBag.slideshow)
.Name("gridHome")
        .Columns(columns =>
        {
            
            columns.Bound(p => p.ID).Hidden();
            columns.Bound(p => p.Title).Column.Title = "name ";
            columns.Bound(p => p.Price).Column.Title = "price";
            columns.Bound(p => p.Text).Column.Title = "price";
            columns.Command(command => command.Custom("edit").Action("Edit", "SlideShow" )).Width(100).Title("edit");
        })
         
        .Sortable()
       
    )

i want this:
C#
columns.Command(command => command.Custom("edit").Action("Edit", "SlideShow", new { id = p=>p.ID })).Width(100).Title("edit");

but this way dont work.
how dow it?
Posted
Comments
Kornfeld Eliyahu Peter 26-Nov-14 8:22am    
Don't work in what way? No id attached to the action URL?
mosi98 26-Nov-14 8:24am    
yes,no id attached to the action.
don't work this code this code have error
columns.Command(command => command.Custom("edit").Action("Edit", "SlideShow", new { id = p=>p.ID })).Width(100).Title("edit");
don't allow use new { id = p=>p.ID } in action
Kornfeld Eliyahu Peter 26-Nov-14 8:26am    
What error?
mosi98 26-Nov-14 8:27am    
don't allow to write this code and not complie
Kornfeld Eliyahu Peter 26-Nov-14 8:34am    
Check these:
http://www.telerik.com/forums/mvc-grid-custom-command-to-call-actionlink-with-parameter-from-grid
http://www.telerik.com/forums/kendo-mvc-grid-actionlink-column

1 solution

C#
columns.Template(c => @Html.ActionLink("edit").ToString(), "foo", new { id = c.ID }));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900