1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-06 08:07:20 +02:00
Radarr/NzbDrone.Web/Helpers/RenderActionHelper.cs
Mark McDowall 5220de5c66 Lazy load exisitng series
New: Existing series will be lazy loaded on Add Series page
2012-10-28 12:08:37 -07:00

26 lines
955 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace NzbDrone.Web.Helpers
{
public static class RenderActionHelper
{
public static MvcHtmlString RenderAction(this AjaxHelper helper, string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions)
{
var urlHelper = new UrlHelper(helper.ViewContext.RequestContext);
var url = urlHelper.Action(actionName, controllerName, routeValues);
var tagBuilder = new TagBuilder("div");
if (ajaxOptions != null) tagBuilder.MergeAttributes<string, object>(ajaxOptions.ToUnobtrusiveHtmlAttributes());
tagBuilder.MergeAttribute("data-ajax-action-link", "true");
tagBuilder.MergeAttribute("data-href", url);
return new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal));
}
}
}