当前位置: 首页>>代码示例>>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;未经允许,请勿转载。