本文整理匯總了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);
}