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

404 Not found

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 28 Oct 2013, 04:12 PM
I'm getting a 404 not found when I click either the Edit, Create, or Delete buttons.  Read works.  I thought this would be pretty straight forward but.....?  Here's my code:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CategoryResultsUpdate([DataSourceRequest] DataSourceRequest request, ProjectCategoryResults pcr)
{
    if (pcr != null && ModelState.IsValid)
    {
        this.m_restWrapper.EditProjectCategoryResults(pcr);
    }
 
    return Json(new[] { pcr }.ToDataSourceResult(request, ModelState));
}
 
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CategoryResultsDestroy([DataSourceRequest] DataSourceRequest request, ProjectCategoryResults pcr)
{
    //if (pcr != null && ModelState.IsValid)
    //{
    //    this.m_restWrapper.EditProjectCategoryResults(pcr);
    //}
 
    return Json(new[] { pcr }.ToDataSourceResult(request, ModelState));
}
 
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CategoryResultsCreate([DataSourceRequest] DataSourceRequest request, ProjectCategoryResults pcr)
{
    if (pcr != null && ModelState.IsValid)
    {
        pcr.CreateDate = DateTime.Now;
        this.m_restWrapper.CreateProjectCategoryResults(pcr);
    }
 
    return Json(new[] { pcr }.ToDataSourceResult(request, ModelState));
}
@model GIS.Portal.Models.ProjectContentViewModel
 
 
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>
 
@(Html.Kendo().Grid<ivision>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(d => d.Name).Title("Divisions");
        })
        .ClientDetailTemplateId("templateSub")
        .HtmlAttributes(new { style = "height:800px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Divisions", "Division", new { projectID = Model.ProjectID }))
        )
)
 
<script id="templateSub" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<SubDivision>()
            .Name("grid_#=DivisionID#")
            .Columns(columns =>
            {
                columns.Bound(s => s.Name).Title("SubDivisions");
 
            })
            .ClientDetailTemplateId("templateCat")
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("SubDivisions", "SubDivision", new { projectID = Model.ProjectID, divisionID = "#=DivisionID#" }))
            )
            .Sortable()
            .ToClientTemplate()
    )
</script>
 
<script id="templateCat" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<ProjectCategoryResults>()
            .Name("grid_#=SubDivisionID#")
            .Columns(columns =>
            {
                columns.Bound(pcr => pcr.CategoryName);
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
            })
            .ToolBar(toolBar => toolBar.Create())
            .Editable(editable => editable.Mode(GridEditMode.InLine)) 
            .DataSource(
                dataSource => dataSource.Ajax()       
                .PageSize(20)       
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(pcr => pcr.ProjectsCategoryResultsID))
                .Read(read => read.Action("CategoryResultsRead", "Category", new { projectID = Model.ProjectID, subDivisionID = "#=SubDivisionID#" }))
                .Create(create => create.Action("CategoryResultsCreate", "Category"))
                .Update(update => update.Action("CategoryResultsUpdate", "Category"))
                .Destroy(destroy => destroy.Action("CategoryResultsDestroy", "Category"))
            )
            .Sortable()
            .Scrollable()
            .ToClientTemplate()
    )
</script>
<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>

1 Answer, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 29 Oct 2013, 02:23 PM
This is fixed.
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Share this question
or