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

[Solved] asp.net mvc grid custom command errors

0 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
J
Top achievements
Rank 1
J asked on 25 Nov 2011, 03:22 PM
I am tying to implement the custom command like in this demo.
Instead of opening the details in a popup form, I would like to redirect to the standard details view.
When I return the details view I get the error "'hr' undefined"

My view-code:
@(Html.Telerik().Grid(Model)       
    .Name("Grid")       
    .Columns(columns =>      
    {               
        columns.Bound(o => o.clientnr).Width(100);           
        columns.Bound(o => o.naam).Width(200);               
        columns.Bound(o => o.geboortedatum).Format("{0:dd-MM-yyyy}").Width(120);
        columns.Command(commands =>
            commands.Custom("viewDetails")
            .Text("Details")
            .DataRouteValues(route => route.Add(o => o.clientnr).RouteKey("clientnr"))
            .Ajax(true)
            .Action("ViewDetails", "Home"))
            .HtmlAttributes(new { style = "text-align: center" }).Width(150);   
    })       
    .DataBinding(dataBinding =>        
    {                   
        dataBinding.Ajax().Select("_Index", "Home").Enabled(true).OperationMode(GridOperationMode.Client);       
    }) 
    .Selectable()     
    .Scrollable(scrolling => scrolling.Enabled(true))       
    .Sortable(sorting => sorting.Enabled(true))       
    .Pageable(paging => paging.Enabled(true))       
    .Filterable(filtering => filtering.Enabled(true))       
    .Groupable(grouping => grouping.Enabled(true))
    .Footer(true)   
    .ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
)

And the controler:
public ViewResult ViewDetails(int clientnr)
        {
            var details = GetClientViewModel().FirstOrDefault(o => o.clientnr == clientnr);           
            return View("Details", details);
        }

Also tried a redirect to route:

public ActionResult ViewDetails(int clientnr)
        {
            return RedirectToRoute("OpenDetails", clientnr);
        }

It's giving me the "Internal server error"

I also can't get into the clientside function onComplete() method.

Can someone help me out with a working solution?
Thanks in advance.
Tags
General Discussions
Asked by
J
Top achievements
Rank 1
Share this question
or