Umbraco 5 - Package - "Save" in editor can't be found
Hello everyone,
I have just begun to work with Umbraco 5 Controllers. So far I can create a tree, make a simple view that are shown with my EditorController. Now I want to save the information in my view with "Save" but when I click it tells me that it couldn't find my controller.
Below can you see my code for the controller.
TournamentEditorController.cs
namespace LoL4U.UI.Controllers
{
[Editor("55a420e9-3410-480a-83d4-39e223e17da5")]
public class TournamentEditorController : StandardEditorController
{
public TournamentEditorController(IBackOfficeRequestContext requestContext) : base(requestContext)
{
}
public override ActionResult Edit(HiveId? id)
{
var tournamentEditorModel = new TournamentEditorModel();
if(id.HasValue)
{
Tournament tournament = Tournament.Get(Convert.ToInt32(id.Value.Value.Value));
if(tournament != null)
{
tournamentEditorModel.Title = tournament.Title;
tournamentEditorModel.Description = tournament.Description;
tournamentEditorModel.Date = Convert.ToDateTime(tournament.Date);
tournamentEditorModel.Location = tournament.Location;
tournamentEditorModel.SignUpFromDate = tournament.SignUpFrom;
tournamentEditorModel.SignUpToDate = tournament.SignUpTo;
}
}
return View("Edit",tournamentEditorModel);
}
[ActionName("Edit")]
[HttpPost]
[Save]
public ActionResult EditForm(HiveId? id)
{
return RedirectToAction("Edit", new {id});
}
}
}
I'm also very new into MVC3 and razor so it can be I have misunderstood something. When I click the disk "Save" it just tells me the page doesn't exist. Can you see what I have done wrong? If you need more code I will gladly post some more :)
Umbraco 5 - Package - "Save" in editor can't be found
Hello everyone,
I have just begun to work with Umbraco 5 Controllers. So far I can create a tree, make a simple view that are shown with my EditorController. Now I want to save the information in my view with "Save" but when I click it tells me that it couldn't find my controller.
Below can you see my code for the controller.
TournamentEditorController.cs
namespace LoL4U.UI.Controllers { [Editor("55a420e9-3410-480a-83d4-39e223e17da5")] public class TournamentEditorController : StandardEditorController { public TournamentEditorController(IBackOfficeRequestContext requestContext) : base(requestContext) { } public override ActionResult Edit(HiveId? id) { var tournamentEditorModel = new TournamentEditorModel(); if(id.HasValue) { Tournament tournament = Tournament.Get(Convert.ToInt32(id.Value.Value.Value)); if(tournament != null) { tournamentEditorModel.Title = tournament.Title; tournamentEditorModel.Description = tournament.Description; tournamentEditorModel.Date = Convert.ToDateTime(tournament.Date); tournamentEditorModel.Location = tournament.Location; tournamentEditorModel.SignUpFromDate = tournament.SignUpFrom; tournamentEditorModel.SignUpToDate = tournament.SignUpTo; } } return View("Edit",tournamentEditorModel); } [ActionName("Edit")] [HttpPost] [Save] public ActionResult EditForm(HiveId? id) { return RedirectToAction("Edit", new {id}); } } }View: Edit.cshtml
@model LoL4U.UI.Model.TournamentEditorModel @using ClientDependency.Core.Mvc @using Microsoft.Web.Mvc @{ Layout = "../../../../../../Areas/Umbraco/Views/Shared/_TabbedEditorLayout.cshtml"; Html.EnableClientValidation(); Html.EnableUnobtrusiveJavaScript(); ViewBag.Action = "Edit"; } @section Head { @{Html.RequiresJs("Umbraco.Editors/UserEditor.js", "Scripts");} <script type="text/javascript"> (function ($) { $(document).ready(function () { Umbraco.Editors.UserEditor.getInstance().init({ activeTabIndex: @Model.ActiveTabIndex , activeTabIndexField: $("#@Html.IdFor(x => Model.ActiveTabIndex)") }); }); })(jQuery); </script> } @section Tabs { <li><a href="#general"><span>General</span></a></li> <li><a href="#settings"><span>Tournament Settings</span></a></li> } @using (Html.BeginForm((string)ViewBag.Action, new Guid("55a420e9-3410-480a-83d4-39e223e17da5"), (object)ViewBag.UrlParams)) { @Html.UmbEditorBar(); @Html.HiddenFor(x => Model.ActiveTabIndex) <div id="editorContent" class="has-editor-bar scrolling-content padded-content"> <div id="general"> <h2>Information</h2> <div class="property-pane clearfix"> @Html.UmbEditorFor(x => Model.Title) @Html.UmbEditorFor(x => Model.Description) @Html.UmbEditorFor(x => Model.Date) @Html.UmbEditorFor(x => Model.Location) </div> <h2>Sign Up</h2> <div class="property-pane clearfix"> @Html.UmbEditorFor(x => Model.SignUpFromDate) @Html.UmbEditorFor(x => Model.SignUpToDate) </div> </div> <div id="settings"> </div> </div> }I'm also very new into MVC3 and razor so it can be I have misunderstood something. When I click the disk "Save" it just tells me the page doesn't exist. Can you see what I have done wrong? If you need more code I will gladly post some more :)
Best Regards Martin
For some reason it seems to work now... hmm... Without any noteable changes.. :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.