404 Not found

2 posts, 1 answers
  1. Answer
    Matt
    Matt avatar
    14 posts
    Member since:
    Oct 2013

    Posted 28 Oct 2013 Link to this post

    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>
  2. Matt
    Matt avatar
    14 posts
    Member since:
    Oct 2013

    Posted 29 Oct 2013 Link to this post

    This is fixed.
Back to Top