當前位置: 首頁>>代碼示例>>C#>>正文


C# ActionResult.AsMVCResult方法代碼示例

本文整理匯總了C#中System.Web.Mvc.ActionResult.AsMVCResult方法的典型用法代碼示例。如果您正苦於以下問題:C# ActionResult.AsMVCResult方法的具體用法?C# ActionResult.AsMVCResult怎麽用?C# ActionResult.AsMVCResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.Mvc.ActionResult的用法示例。


在下文中一共展示了ActionResult.AsMVCResult方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UrlWithActionFragment

 public static string UrlWithActionFragment(this UrlHelper urlHelper, ActionResult fragmentAction)
 {
     return String.Format("{0}#{1}",
                 RouteTable.Routes.GetVirtualPathForArea(urlHelper.RequestContext,
                                                 new RouteValueDictionary(new
                                                 {
                                                     area = string.Empty,
                                                     controller = fragmentAction.AsMVCResult().Controller,
                                                     action = string.Empty,
                                                 })).VirtualPath,
                  fragmentAction.AsMVCResult().Action);
 }
開發者ID:avijassra,項目名稱:MyNotes,代碼行數:12,代碼來源:UrlHelperExtension.cs

示例2: ActionLinkWithFragment

        public static MvcHtmlString ActionLinkWithFragment(this HtmlHelper htmlHelper, string text, ActionResult fragmentAction, string cssClass = null, string dataOptions = null)
        {
            var mvcActionResult = fragmentAction.AsMVCResult() as IMvcResult;

            if (mvcActionResult == null)
                return null;

            var options = string.Empty;

            var actionLink = string.Format("{0}#{1}",
                        RouteTable.Routes.GetVirtualPathForArea(htmlHelper.ViewContext.RequestContext,
                                                        new RouteValueDictionary(new
                                                        {
                                                            area = string.Empty,
                                                            controller = mvcActionResult.Controller,
                                                            action = string.Empty,
                                                        })).VirtualPath,
                         mvcActionResult.Action);

            if (!string.IsNullOrEmpty(dataOptions))
                options = "data-options=\"" + dataOptions.Trim() + "\"";

            return new MvcHtmlString(string.Format("<a id=\"{0}\" href=\"{1}\" class=\"jqAddress {2}\" {3}>{4}</a>", Guid.NewGuid(), actionLink,
                (string.IsNullOrEmpty(cssClass) ? string.Empty : cssClass.Trim()),
                (string.IsNullOrEmpty(options) ? string.Empty : options.Trim()), text));
        }
開發者ID:avijassra,項目名稱:MyNotes,代碼行數:26,代碼來源:HtmlHelperExtension.cs

示例3: BeginJqueryForm

        public static MvcForm BeginJqueryForm(this AjaxHelper ajaxHelper, string formId, ActionResult actionResult, bool isAjax, string eventName, string updateId, string cssClassNames)
        {
            var callInfo = actionResult.AsMVCResult();

            return BeginJqueryForm(ajaxHelper, callInfo.Action, callInfo.Controller, formId, isAjax, eventName, updateId, callInfo.RouteValueDictionary, cssClassNames, null /* htmlAttributes */);
        }
開發者ID:avijassra,項目名稱:CodeLab,代碼行數:6,代碼來源:JqueryExtension.cs

示例4: UrlWithAction

        public static string UrlWithAction(this UrlHelper urlHelper, ActionResult controllerAction)
        {
            var callInfo = controllerAction.AsMVCResult();

            return urlHelper.Action(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
        }
開發者ID:avijassra,項目名稱:MyNotes,代碼行數:6,代碼來源:UrlHelperExtension.cs


注:本文中的System.Web.Mvc.ActionResult.AsMVCResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。