本文整理汇总了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);
}
示例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));
}
示例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 */);
}
示例4: UrlWithAction
public static string UrlWithAction(this UrlHelper urlHelper, ActionResult controllerAction)
{
var callInfo = controllerAction.AsMVCResult();
return urlHelper.Action(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
}