当前位置: 首页>>代码示例>>C#>>正文


C# ActionResult.GetT4MVCResult方法代码示例

本文整理汇总了C#中System.Web.Mvc.ActionResult.GetT4MVCResult方法的典型用法代码示例。如果您正苦于以下问题:C# ActionResult.GetT4MVCResult方法的具体用法?C# ActionResult.GetT4MVCResult怎么用?C# ActionResult.GetT4MVCResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.ActionResult的用法示例。


在下文中一共展示了ActionResult.GetT4MVCResult方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeActiveClass

        public static string MakeActiveClass(this UrlHelper urlHelper, ActionResult controller)
        {
            string result = null;

            if (
                (controller.GetT4MVCResult().Controller == urlHelper.RequestContext.RouteData.Values["controller"].ToString()) &&
                (controller.GetT4MVCResult().Action == urlHelper.RequestContext.RouteData.Values["action"].ToString())
                )
            {
                result = "active";;
            }

            return result;
        }
开发者ID:Doozie7,项目名称:BMPE,代码行数:14,代码来源:CustomExtensions.cs

示例2: NavActionLink

        /// <summary>
        /// Creates a Navigation action link inside an li tag that highlights based on which page you're on.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper.</param>
        /// <param name="linkText">The link text.</param>
        /// <param name="actionResult">The action result.</param>
        /// <returns></returns>
        public static MvcHtmlString NavActionLink(this HtmlHelper htmlHelper, string linkText, ActionResult actionResult)
        {
            var result = actionResult.GetT4MVCResult();

            var li = new TagBuilder("li");

            // create anchor tag
            var anchor = HtmlHelper.GenerateLink(
                    htmlHelper.ViewContext.RequestContext,
                    RouteTable.Routes,
                    linkText,
                    "",
                    result.Action,
                    result.Controller,
                    result.RouteValueDictionary,
                    null);

            // add anchor tag to li tag
            li.InnerHtml = anchor;

            // get the route data
            var controller = htmlHelper.ViewContext.Controller.ValueProvider.GetValue("controller").RawValue as string;
            var action = htmlHelper.ViewContext.Controller.ValueProvider.GetValue("action").RawValue as string;
            if (result.Action == action && result.Controller == controller)
            {
                li.MergeAttribute("class", "active");
            }

            return MvcHtmlString.Create(li.ToString());
        }
开发者ID:Cartman380,项目名称:CruisinForChildren,代码行数:37,代码来源:HtmlHelperExtensions.cs

示例3: RedirectToLocal

        public static ActionResult RedirectToLocal(this Controller controller, ActionResult action)
        {
            if (action != null && controller.Url.IsLocalUrl(controller.Url.Action(action)))
                return new RedirectToRouteResult(action.GetT4MVCResult().RouteValueDictionary);

            return new RedirectToRouteResult(MVC.Home.Index().GetT4MVCResult().RouteValueDictionary);
        }
开发者ID:phobos04,项目名称:tripod,代码行数:7,代码来源:ControllerExtensions.cs

示例4: RedirectToAction

        public static ActionResult RedirectToAction(this Controller controller, ActionResult result, string urlFragment)
        {
            var callInfo = result.GetT4MVCResult();

            if (!string.IsNullOrWhiteSpace(urlFragment))
            {
                var url = UrlHelper.GenerateUrl(null, null, null, callInfo.RouteValueDictionary, RouteTable.Routes, controller.HttpContext.Request.RequestContext, false);

                url = string.Concat(url, "#", urlFragment);

                return new RedirectResult(url, false);
            }
            else
            {
                return new RedirectToRouteResult(callInfo.RouteValueDictionary);
            }
        }
开发者ID:garysharp,项目名称:Disco,代码行数:17,代码来源:ControllerExtensions.cs

示例5: RedirectToActionPermanent

 protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
 {
     var callInfo = result.GetT4MVCResult();
     return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
 }
开发者ID:4Rebin,项目名称:MVCBlog,代码行数:5,代码来源:LoginController.generated.cs

示例6: BeginForm

 public static MvcForm BeginForm(this HtmlHelper htmlHelper, ActionResult result, FormMethod formMethod, IDictionary<string, object> htmlAttributes)
 {
     var callInfo = result.GetT4MVCResult();
     return htmlHelper.BeginForm(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary, formMethod, htmlAttributes);
 }
开发者ID:shahr00z,项目名称:TavanTarkhis,代码行数:5,代码来源:T4MVC.cs

示例7: ActionLink

 public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, ActionResult result, IDictionary<string, object> htmlAttributes, string protocol, string hostName, string fragment)
 {
     return htmlHelper.RouteLink(linkText, null, protocol ?? result.GetT4MVCResult().Protocol, hostName, fragment, result.GetRouteValueDictionary(), htmlAttributes);
 }
开发者ID:shahr00z,项目名称:TavanTarkhis,代码行数:4,代码来源:T4MVC.cs

示例8: Action

 public static string Action(this UrlHelper urlHelper, ActionResult result, string protocol = null, string hostName = null)
 {
     return urlHelper.RouteUrl(null, result.GetRouteValueDictionary(), protocol ?? result.GetT4MVCResult().Protocol, hostName);
 }
开发者ID:shahr00z,项目名称:TavanTarkhis,代码行数:4,代码来源:T4MVC.cs

示例9: RenderAction

 public static void RenderAction(this HtmlHelper htmlHelper, ActionResult result)
 {
     var callInfo = result.GetT4MVCResult();
     htmlHelper.RenderAction(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
 }
开发者ID:shahr00z,项目名称:TavanTarkhis,代码行数:5,代码来源:T4MVC.cs

示例10: ActionLink

 public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, ActionResult result, object htmlAttributes, string protocol = null, string hostName = null, string fragment = null) {
     return htmlHelper.RouteLink(linkText, null, protocol ?? result.GetT4MVCResult().Protocol, hostName, fragment, result.GetRouteValueDictionary(), HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
开发者ID:IanFelton,项目名称:WeNeedUHave,代码行数:3,代码来源:T4MVC.cs

示例11: RouteUrl

 public static string RouteUrl(this UrlHelper urlHelper, string routeName, ActionResult result, string protocol, string hostName)
 {
     return urlHelper.RouteUrl(routeName, result.GetRouteValueDictionary(), protocol ?? result.GetT4MVCResult().Protocol, hostName);
 }
开发者ID:rabbal,项目名称:Decision,代码行数:4,代码来源:T4SecureExtensions.cs

示例12: BeginActionLink

 /// <summary>
 /// Begins a new action link.  For use in a using statement, allowing other code inside the tag.
 /// </summary>
 /// <param name="htmlHelper">The class being extended with this method.</param>
 /// <param name="result">An IT4MVCActionResult from a T4 MVC action method used to help build urls.</param>
 /// <param name="htmlAttributes">A dictionary with name and value pairs.</param>
 /// <returns></returns>
 public static MvcTag BeginActionLink(this HtmlHelper htmlHelper, ActionResult result, IDictionary<string, object> htmlAttributes)
 {
     var callInfo = result.GetT4MVCResult();
     return htmlHelper.BeginActionLink(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary, htmlAttributes);
 }
开发者ID:Genyus,项目名称:candor-common,代码行数:12,代码来源:MvcTagHtmlHelperExtension.cs

示例13: ActionImageTag

 /// <summary>
 /// Generates an anchor tag (link) with an image inside such that the image when clicked follows the specified MVC route.
 /// </summary>
 /// <param name="helper">The class being extended with this method.</param>
 /// <param name="result">An IT4MVCActionResult from a T4 MVC action method used to help build urls.</param>
 /// <param name="imageFileName">The file name of the image including full relative path.  Recommend coming from T4MVC Links property.</param>
 /// <param name="anchorHtmlAttributes">A dynamic object with name and value pairs for the anchor tag.  Example:  new {data-custom1="abc", @class="large"}</param>
 /// <param name="imageHtmlAttributes">A dynamic object with name and value pairs for the image tag.  Example:  new {data-custom1="abc", @class="large"}</param>
 /// <returns></returns>
 public static MvcHtmlString ActionImageTag(this HtmlHelper helper, ActionResult result, string imageFileName, object anchorHtmlAttributes, object imageHtmlAttributes)
 {
     IT4MVCActionResult t4 = result.GetT4MVCResult();
     return ActionImageTag(helper, t4.Action, t4.Controller, imageFileName, t4.RouteValueDictionary, anchorHtmlAttributes, imageHtmlAttributes);
 }
开发者ID:Genyus,项目名称:candor-common,代码行数:14,代码来源:HtmlHelperExtension.cs


注:本文中的System.Web.Mvc.ActionResult.GetT4MVCResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。