Editor in seperate view

2 posts, 1 answers
  1. Chrys
    Chrys avatar
    45 posts
    Member since:
    Feb 2013

    Posted 11 Jun 2013 Link to this post

    Is there a way to edit grid rows in a separate view. I need to accomplish this because the modal has too much information so it needs to be displayed in a separate view.

    grid.bind("edit", function (e) {
                    window.location = '@Url.Action("AddEditCoalition","Form",new{coalitionId=Model.CoalitionId})' + '&formId=' + e.model.Id;
    });
    The only problem is the modal shows up is there anyway to do this without the modal showing at all and it goes stratight to the seperate view?
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 13 Jun 2013 Link to this post

    Hello Chrys,

    A more appropriate way to navigate to a separate view will be to use a custom command and to handle its click event in which to navigate to the other page:

    @(Html.Kendo().Grid<Model>()   
        .Name("Grid")
        .Columns(columns => {   
            /*...*/
            columns.Command(command => command.Custom("Edit").Click("showEditForm"));
        })   
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(/*..*/)
         )
    )
     
    <script type="text/javascript">
        function showEditForm(e) {
            e.preventDefault();
                     
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
     
            window.location.href = '@Url.Action("AddEditCoalition","Form",new{coalitionId=Model.CoalitionId})' + '&formId=' + dataItem.Id;
        }
    </script>


    Regards,
    Rosen
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top