您的位置:首页 > 其它

umbraco note-MVC

2015-05-22 09:42 393 查看
SurfaceController

1.Creating an action to partake in a Child Action Macro. To define this is very simple and follows

the exact same MVC principles to creating a Child Action...just add a ChildActionOnlyAttribute to your

action method.

[ChildActionOnly]

public ActionResult DisplayTwitterFeed()

2.Creating a child action to simply be used as a normal MVC child action which get rendered using 

@Html.Action or @Html.RenderAction.

3.Create an action to handle some posted form data:

[httpPost]

public ActionResult HandleMyFormSubmission(MyFormModel model)

4.Maybe you'd like to track all links clicked on your page. you could use jquery to update all of your

links on your page to point to your custom action URL with the real URL as a query string. Then your

custom action will log the real link address and redirect the user to where they want to go.

--------------------------------------------------------------------------------------

// e.g. if modelstate is invalid

return CurrentUmbracoPage();

// redirecting back to original page after a successful post

return RedirectToCurrentUmbracoPage(); 

// Redirecting to another page after a successful post

return RedirectToUmbracoPage(12345)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Umbraco