asked    Olive     2018-10-12       asp.net-mvc       14 view        1 Answer

[SOLVED] How To call An Action In Umbraco Controller?

I created an Umbraco DocumentType with the alias Personal and created a controller that inherits

Umbraco.Web.Mvc.RenderMvcController

I added two Actions, one is the default action and the other is called Test.

How can I fire the Test Action from the Personal controller?

public class PersonalController : Umbraco.Web.Mvc.RenderMvcController
{
    // GET: Personal
    public override ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }

    public String Test(RenderModel model)
    {
        return "fff";
    }
}

When I put the url like this: localHost/personal/test it shows:

No umbraco document matches the url '/test'.

Which is right, so how can I call it?

  1 Answer  

        answered    Darlene     2018-10-12      

I would do it like this

[HttpPost]
public ActionResult SubmitSearchForm(SearchViewModel model)
{
    if (ModelState.IsValid)
    {
        if (!string.IsNullOrEmpty(model.SearchTerm))
        {
            model.SearchTerm = model.SearchTerm;
            model.SearchGroups = GetSearchGroups(model);
            model.SearchResults = _searchHelper.GetSearchResults(model, Request.Form.AllKeys);
        }
        return RenderSearchResults(model.SearchResults);
    }
    return null;
}

public ActionResult RenderSearchResults(SearchResultsModel model)
{
    return PartialView(PartialViewPath("_SearchResults"), model);
}

See this blog post for the full context behind where this code snippet came from.





Your Answer





 2018-10-12         Magee

Umbraco Forms image upload to media picker

I've read on our.umbraco.org that the Umbraco Forms' "file upload" can be used to upload images that can then be used by the media picker.I've created a workflow which creates an Umbraco document, and I mapped the file upload to the document type's media picker and all the other properties are of course mapped as well.Whenever I submit the form, it creates the unpublished node as it should, and it maps all the properties EXCEPT the media picker. I can't figure out why...I'm on Umbraco version: 7.3.7.Thank you in advance. This is an old question but just for the records. ...
 c#                     1 answers                     94 view
 2018-10-12         Martina

Import entries to Umbraco Contour

Is there a way (the best would be an Excel importer) to import entries to an Umbraco Contour form? As far as I know, there is currently no way to import records to Contour out of the box I'm afraid. You'd have to use the Contour APIs and do it yourself, although there will be some complexities around items that have lists, like dropdown lists or multiple checkboxes. [XXX]
 umbraco7                     1 answers                     95 view
 2018-10-12         Katherine

Refreshing the page even if error message is shown

I'm using umbraco CMS and have a problem with my form.I've added error messagges if some of the fields are empty.If you click on "submit" the page is refreshing, and you need to scroll down again to the form section in order to view the error messages.I did a lot of changes in the form section (design) but can't find a solution to the problem.Has anyone had the same issue? Are you using the new UmbracoForms implementation? This sounds to me like a script or style issue. You should track when the user has submitted the form and after the submission (if there are errors pr...
 forms                     1 answers                     96 view