我创建了一个带有别名DocumentType
的Umbraco Personal
并创建了一个继承
Umbraco.Web.Mvc.RenderMvcController
我添加了两个Action
,一个是默认操作,另一个是Test
。
如何从Test
控制器触发Personal
操作?
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";
}
}
当我按下这样的网址时:localHost/personal/test
显示:
没有umbraco文档与网址'/ test'匹配。
哪个是对的,我怎么称呼它?
答案 0 :(得分:2)
我会这样做
[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);
}
请参阅此博客文章,了解此代码段所在的完整背景信息。
http://www.codeshare.co.uk/blog/how-to-search-by-document-type-and-property-in-umbraco/