Hello all,
I create a project in visual studio and install umbraco via nuget. then Customize the database and install umbraco then created one table in database and try to insert values using surface controller but I'm not able to call the controller.
Below code Shows the Model
public class test
{
public string Title { get; set; }
public string Genre { get; set; }
public int Year { get; set; }
}
Yes my SurfaceController inherit from SurfaceController.
Below is my full code
public class MovieSurfaceController : Umbraco.Web.Mvc.SurfaceController
{
// GET: Movie
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult CreateComment(Company model)
{
//model not valid, do not save, but return current Umbraco page
if (!ModelState.IsValid)
{
//Perhaps you might want to add a custom message to the ViewBag
//which will be available on the View when it renders (since we're not
//redirecting)
return CurrentUmbracoPage();
}
//Add a message in TempData which will be available
//in the View after the redirect
TempData.Add("CustomMessage", "Your form was successfully submitted at " + DateTime.Now);
//redirect to current page to clear the form
//return RedirectToCurrentUmbracoPage();
return RedirectToUmbracoPage(1059);
}
}
Need Help on Surface Controller
Hello all, I create a project in visual studio and install umbraco via nuget. then Customize the database and install umbraco then created one table in database and try to insert values using surface controller but I'm not able to call the controller.
Below code Shows the Model
below code shows the controller
After that i created one partial view.
After i create template and call this Partial view.
But i m not able to call the controller.
Any help would be appreciated.
Thanks
Ronak Panchal.
Does your SurfaceController inherit from SurfaceController? Can you add the class definition of your SurfaceController?
hello mark,
Thanks for sharing your point of view !
Yes my SurfaceController inherit from SurfaceController.
Below is my full code
Rather than
Html.BeginForm
, tryHtml.BeginUmbracoForm
.That will inject a hidden field with a name of "ufprt" that helps Umbraco's routing engine fine the appropriate surface controller.
Hello Nicholas,
i already try
Html.BeginUmbracoForm
But not able to call the controller.
Thanks, Ronak Panchal
Hi Ronak,
you should definitly use BeginUmbracoForm as it's the right way to call the controller.
The code you posted seems correct to me. Will try to check if I find some old code if mine to share.
Regards David
Hi David,
Thanks in advance that you could try to check and find some code related to surface controller and find out that what i m missing in my code.
Any help would be appreciated !
Regards, Ronak.
is working on a reply...