public static MvcHtmlString ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actionName,
		                                            string controllerName, object routeValues, AjaxOptions ajaxOptions,
		                                            object htmlAttributes)
        {
            return ComposeImageActionLink(helper, imageUrl, altText, actionName, controllerName, routeValues, ajaxOptions,
                htmlAttributes);
        }
Exemplo n.º 2
0
        internal PagerBuilder(AjaxHelper helper, string actionName, string controllerName, int totalPageCount, int pageIndex, PagerOptions options, AjaxOptions ajaxOptions, object values)
        {
            // Set defaults
            if (String.IsNullOrEmpty(actionName))
                actionName = (string)helper.ViewContext.RouteData.Values["action"];
            if (String.IsNullOrEmpty(controllerName))
                controllerName = (string)helper.ViewContext.RouteData.Values["controller"];
            if (options == null)
                options = new PagerOptions();

            // Assign to fields
            _helper = helper;
            _actionName = actionName;
            _controllerName = controllerName;
            _totalPageCount = totalPageCount;
            _pageIndex = pageIndex;
            _options = options;
            _values = values;
            _ajaxOptions = ajaxOptions;

            // Calculate start page index
            _startPageIndex = pageIndex - (options.MaximumPageNumbers / 2);
            if (_startPageIndex + options.MaximumPageNumbers > _totalPageCount)
                _startPageIndex = _totalPageCount - options.MaximumPageNumbers;
            if (_startPageIndex < 0)
                _startPageIndex = 0;

            // Calculate end page index
            _endPageIndex = _startPageIndex + _options.MaximumPageNumbers;
            if (_endPageIndex > _totalPageCount)
                _endPageIndex = _totalPageCount;

        }
Exemplo n.º 3
0
        public static MvcHtmlString PagingNavigator(this AjaxHelper helper, int pageNum, int itemsCount, int pageSize)
        {
            StringBuilder sb = new StringBuilder();
            AjaxOptions ao = new AjaxOptions {UpdateTargetId = "BooksDiv"};

            if (pageNum > 0)
            {
                sb.Append(helper.ActionLink("<", "Index","Books", new { pageNum = pageNum - 1 },ao));
            }
            else
            {
                sb.Append(HttpUtility.HtmlEncode("<"));
            }
            sb.Append(" ");

            int pagesCount = (int)Math.Ceiling((double)itemsCount / pageSize);

            if (pageNum < pagesCount - 1)
            {
                sb.Append(helper.ActionLink(">", "Index","Books", new { pageNum = pageNum + 1 },ao));
            }
            else
            {
                sb.Append(HttpUtility.HtmlEncode(">"));
            }

            return MvcHtmlString.Create(sb.ToString());
        }
Exemplo n.º 4
0
        public static string SortableColumnHeader(this AjaxHelper helper, HtmlHelper htmlHelper, TicketCenterListSettings currentDisplayPreferences, string action, string listName, string sortColumn, string linkText, AjaxOptions ajaxOptions)
        {
            var imgContent = string.Empty;
            var linkContent = linkText;
            var indexContent = string.Empty;
            var sortColumns = currentDisplayPreferences.SortColumns;
            var cColumn = sortColumns.SingleOrDefault(sc => sc.ColumnName == sortColumn);
            if (cColumn != null)
            {
                var uh = new UrlHelper(helper.ViewContext.RequestContext);
                string imgSrc = uh.Content((cColumn.SortDirection == ColumnSortDirection.Ascending) ? "~/Content/arrow_top.png" : "~/Content/arrow_down.png");
                imgContent = string.Format("<img src='{0}' alt='{1}' />", imgSrc, cColumn.SortDirection.ToString());

                var idx = sortColumns.IndexOf(cColumn) + 1;
                indexContent = string.Format("<sup>[{0}]</sup>",idx.ToString());
            }

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<span style='white-space:nowrap;'>");
            var lLine = helper.ActionLink(linkContent, "SortList", new { ListName = listName, ColumnName = sortColumn }, ajaxOptions, new { OnMouseDown = "setShiftStatus(event);", Title = "[shift+click] to add or remove columns from the sort" }).ToString();


            sb.AppendLine(lLine + indexContent);
            sb.AppendLine(imgContent);
            sb.AppendLine("</span>");
            return sb.ToString();
        }
Exemplo n.º 5
0
        public static string ActionLink(this AjaxHelper ajaxHelper, string linkText, string actionName, string controllerName,
		                                object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
        {
            var newValues = new RouteValueDictionary(routeValues);
            var newAttributes = ObjectToCaseSensitiveDictionary(htmlAttributes);
            return ActionLink(ajaxHelper, linkText, actionName, controllerName, newValues, ajaxOptions, newAttributes);
        }
Exemplo n.º 6
0
        public static string ActionLink(this AjaxHelper ajaxHelper, string linkText, string actionName,
		                                RouteValueDictionary routeValues, AjaxOptions ajaxOptions,
		                                IDictionary<string, object> htmlAttributes)
        {
            return ActionLink(ajaxHelper, linkText, actionName, null /* controllerName */, routeValues, ajaxOptions,
                              htmlAttributes);
        }
Exemplo n.º 7
0
 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     if (pagedList == null)
         return AjaxPager(html, pagerOptions, null);
     return AjaxPager(html, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null, ajaxOptions,
                      null);
 }
Exemplo n.º 8
0
 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     if (pagedList == null)
         return AjaxPager(html, pagerOptions, new RouteValueDictionary(htmlAttributes));
     return AjaxPager(html, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null,
                      ajaxOptions, htmlAttributes);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Метод создает ссылку, которая с помощью Ajax запроса загружает в контейнер с именем main
 /// требуемый PartialView
 /// </summary>
 public static MvcHtmlString ActionLinkTo(this AjaxHelper ajaxHelper, String linkText, String actionName, String controllerName = null, Object routeValues = null, String areaName = null, String loadMessage = null, Object htmlAttributes = null)
 {
     // Создаем маршрут
     RouteValueDictionary routeValueDictionary = routeValues == null ? new RouteValueDictionary() : (RouteValueDictionary)(routeValues);
     if (!String.IsNullOrEmpty(actionName) && !routeValueDictionary.ContainsKey("action"))
         routeValueDictionary.Add("action", actionName);
     if (!String.IsNullOrEmpty(controllerName) && !routeValueDictionary.ContainsKey("controller"))
         routeValueDictionary.Add("controller", controllerName);
     if (!routeValueDictionary.ContainsKey("area")) {
         if (!String.IsNullOrEmpty(areaName))
             routeValueDictionary.Add("area", areaName);
         else
             routeValueDictionary.Add("area", "");
     }
     // Создаем параметры Ajax
     AjaxOptions ajaxOptions = new AjaxOptions() {
         UpdateTargetId = "main",
         InsertionMode = InsertionMode.Replace,
         HttpMethod = "POST",
         LoadingElementId = "loadLayout",
         OnBegin = "changeLoadMesage('" + loadMessage + "')",
         OnSuccess = "onPageLoaded()"
     };
     RouteValueDictionary htmlatr = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
     htmlatr.Add("onclick", "return ajaxClick(this);");
     // Возвращаем строку
     String ajaxActionName = "Ajax" + actionName;
     return ajaxHelper.ActionLink(linkText, ajaxActionName, null, routeValueDictionary, ajaxOptions, htmlatr);
 }
Exemplo n.º 10
0
 public static IHtmlString InputActionLink(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions)
 {
     var builder = new TagBuilder("input");
     var link = ajaxHelper.ActionLink("[replaceme]", result, ajaxOptions);
     var mvcLink = new MvcHtmlString(link.ToHtmlString().Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)));
     return mvcLink;
 }
Exemplo n.º 11
0
        // using timjames' approach
        public static MvcHtmlString RawActionLink(this AjaxHelper ajaxHelper, string rawHtml, string action, string controller, AjaxOptions ajaxOptions, object routeValues = null, object htmlAttributes = null)
        {
            string linkText = Guid.NewGuid().ToString();
            string originalActionLink = ajaxHelper.ActionLink(linkText, action, controller, routeValues, ajaxOptions, htmlAttributes).ToString();

            return MvcHtmlString.Create(originalActionLink.Replace(linkText, rawHtml));
        }
Exemplo n.º 12
0
        public static MvcForm BeginPostForm(this AjaxHelper ajaxHelper, 
                                            string url, object routeValues, string beginCallback, 
                                            string successCallback, string failureCallback, string validationCallback, object htmlAttributes)
        {
            MvcForm retVal = null;

            beginCallback = HandledNullOrEmptyCallbacks(beginCallback);
            successCallback = HandledNullOrEmptyCallbacks(successCallback);
            failureCallback = HandledNullOrEmptyCallbacks(failureCallback);
            validationCallback = HandledNullOrEmptyCallbacks(validationCallback);

            AjaxOptions ajaxOptions = new AjaxOptions()
            {
                Url = url,
                HttpMethod = "POST",
                OnBegin = beginCallback,
                OnSuccess = CommonFormSubmitSuccessCallback.Replace(
                            SuccessCallbackPlaceholder, successCallback).Replace(
                            FailureCallbackPlaceholder, failureCallback).Replace(ValidationCallbackPlaceholder, validationCallback),
                OnFailure = CommonFormSubmitFailureCallback
            };

            retVal = ajaxHelper.BeginForm(string.Empty, routeValues, ajaxOptions, htmlAttributes);

            return retVal;
        }
 public static MvcHtmlString RawAjaxActionLink(this AjaxHelper ajaxHelper, string linkText, string actionName, 
     string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     var repId = Guid.NewGuid().ToString();
     var lnk = ajaxHelper.ActionLink(repId, actionName, controllerName, routeValues, ajaxOptions, htmlAttributes);
     return MvcHtmlString.Create(lnk.ToString().Replace(repId, linkText));
 }
        public static IHtmlString DisplayNameForSort(this AjaxHelper helper, string displayName, string columName, string actionName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, string controllerName = null)
        {
            if (!string.IsNullOrWhiteSpace(columName))
            {
                string orderBy;
                string iconName;
                HtmlHelperExtensions.GetListOrderParams(columName, out orderBy, out iconName);
                if (routeValues.ContainsKey("orderBy"))
                {
                    routeValues["orderBy"] = orderBy;
                }
                else
                {
                    routeValues.Add("orderBy", orderBy);
                }

                MvcHtmlString link;
                if (string.IsNullOrEmpty(controllerName))
                {
                    link = helper.ActionLink(displayName, actionName, routeValues, ajaxOptions);
                }
                else
                {
                    link = helper.ActionLink(displayName, actionName, controllerName, routeValues, ajaxOptions);
                }

                string htmlStr = "<div class=\"ap-sortedHeader\">{0}<i class=\"ap-sortedHeader fa {1}\"></i></div>";
                return new MvcHtmlString(string.Format(htmlStr, link.ToString(), iconName));
            }
            else
            {
                return new MvcHtmlString(displayName);
            }
        }
Exemplo n.º 15
0
 public static MvcHtmlString IconActionLink(this AjaxHelper helper, string icon, string linkText, string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     var builder = new TagBuilder("span");
     builder.MergeAttribute("class", icon);
     var link = helper.ActionLink("[replaceme] " + linkText, actionName, controllerName, routeValues, ajaxOptions, htmlAttributes).ToHtmlString();
     return new MvcHtmlString(link.Replace("[replaceme]", builder.ToString()));
 }
        public static ComponentBuilder <TConfig, FluentBootstrap.Forms.Form> AjaxForm <TConfig, TComponent>(
            this BootstrapHelper <TConfig, TComponent> helper,
            string formAction,
            System.Web.Mvc.Ajax.AjaxOptions ajaxOptions = null
            ) where TConfig : BootstrapConfig where TComponent : Component, ICanCreate <FluentBootstrap.Forms.Form>
        {
            var id = SomeRandom.Id();

            ajaxOptions = ajaxOptions ?? new AjaxOptions()
            {
                InsertionMode  = InsertionMode.Replace,
                UpdateTargetId = "main-modal-body",
                OnSuccess      = "indexViewModel.modalLoaded",
                OnFailure      = "indexViewModel.postFailed",
                OnComplete     = "Ladda.bind('.ladda-button')",
            };

            var form = helper.Form()
                       .AddAttribute("action", formAction)
                       .AddAttribute("method", "post")
                       .AddAttributes(ajaxOptions.ToUnobtrusiveHtmlAttributes())
                       .SetId(id);

            return(form);
        }
Exemplo n.º 17
0
        private static string GenerateAjaxScript(AjaxOptions ajaxOptions, string scriptFormat)
        {
            var ajaxOptionsHelper = new AjaxOptionsHelper(ajaxOptions);
            string optionsString = ajaxOptionsHelper.ToJavascriptString();

            return String.Format(CultureInfo.InvariantCulture, scriptFormat, optionsString);
        }
        /// <summary>
        /// Builds an ActionLink with the Image as text.
        /// </summary>
        /// <param name="ajaxHelper">The helper.</param>
        /// <param name="imageUri">The image URL.</param>
        /// <param name="title">The title text.</param>
        /// <param name="actionName">Name of the action.</param>
        /// <param name="routeValues">The route values.</param>
        /// <param name="ajaxOptions">The ajax options.</param>
        /// <param name="htmlAttributes">The HTML attributes.</param>
        /// <returns></returns>
        public static IHtmlString ImageActionLink(this AjaxHelper ajaxHelper, Uri imageUri, string title, string actionName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
        {
            Arg.IsNotNull(() => imageUri);

            var builder = BuildImageTag(imageUri, title, htmlAttributes);
            var link = ajaxHelper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions).ToHtmlString();
            return MvcHtmlString.Create(link.Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)));
        }
 public static IHtmlString IconActionLink(this AjaxHelper helper, string iconClass, string actionName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes = null)
 {
     var builder = new TagBuilder("i");
     builder.MergeAttribute("class", iconClass);
     builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
     var link = helper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions).ToHtmlString();
     return MvcHtmlString.Create(link.Replace("[replaceme]", builder.ToString(TagRenderMode.Normal)));
 }
Exemplo n.º 20
0
 public static MvcHtmlString RawActionLink(this AjaxHelper ajaxHelper, string rawHtml, string action, string controller, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     //string anchor = ajaxHelper.ActionLink("##holder##", action, controller, routeValues, ajaxOptions, htmlAttributes).ToString();
     //return MvcHtmlString.Create(anchor.Replace("##holder##", rawHtml));
     string holder = Guid.NewGuid().ToString();
     string anchor = ajaxHelper.ActionLink(holder, action, controller, routeValues, ajaxOptions, htmlAttributes).ToString();
     return MvcHtmlString.Create(anchor.Replace(holder, rawHtml));
 }
Exemplo n.º 21
0
 public static IHtmlString InputActionLink(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     var builder = new TagBuilder("input");
     builder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
     var link = ajaxHelper.ActionLink("[replaceme]", result, ajaxOptions);
     var mvcLink = new MvcHtmlString(link.ToHtmlString().Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)));
     return mvcLink;
 }
 public static string ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actionName, object routeValues, AjaxOptions ajaxOptions)
 {
     var builder = new TagBuilder("img");
     builder.MergeAttribute("src", imageUrl);
     builder.MergeAttribute("alt", altText);
     var link = helper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions);
     return link.ToString().Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing));
 }
Exemplo n.º 23
0
 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
 {
     if (pagedList == null)
     {
         return AjaxPager(html, pagerOptions, htmlAttributes);
     }
     return html.AjaxPager(pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null, ajaxOptions, htmlAttributes);
 }
 public PagingRouteValue(string actionName, string controllerName, object optionValues = null, AjaxOptions ajaxOption = null, string prefix = "") : this()
 {
     this.ActionName = actionName;
     this.ControllerName = controllerName;
     this.AjaxOptions = ajaxOption;
     this.OptionValues = optionValues;
     this.RouteValuePrefix = prefix;
 }
 public BootstrapActionLink(AjaxHelper ajax, string linkText, ActionResult result, AjaxOptions ajaxOptions)
 {
     this.ajax = ajax;
     this._linkText = linkText;
     this._result = result;
     this._ajaxOptions = ajaxOptions;
     this._actionTypePassed = ActionTypePassed.AjaxActionResult;
 }
Exemplo n.º 26
0
 public AjaxPager(AjaxHelper helper, ViewContext viewContext, Options options, AjaxOptions ajaxOptions, RouteValueDictionary valueDictionary)
 {
     this.ajaxHelper = helper;
     this.viewContext = viewContext;
     this.options = options;
     this.ajaxOptions = ajaxOptions;
     this.linkWithoutPageValuesDictionary = valueDictionary;
 }
Exemplo n.º 27
0
 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, string actionName, string controllerName, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     if (pagedList == null)
     {
         return AjaxPager(html, pagerOptions, null);
     }
     return html.AjaxPager(pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, actionName, controllerName, null, pagerOptions, ((RouteValueDictionary)null), ajaxOptions, ((IDictionary<string, object>)null));
 }
Exemplo n.º 28
0
 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, string routeName, object routeValues, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     if (pagedList == null)
     {
         return AjaxPager(html, pagerOptions, null);
     }
     return html.AjaxPager(pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, routeName, pagerOptions, routeValues, ajaxOptions, null);
 }
Exemplo n.º 29
0
 private static void ProcessOnComplete(AjaxOptions ajaxOptions)
 {
   if (string.IsNullOrEmpty(ajaxOptions.OnComplete))
   {
     ajaxOptions.OnComplete = "defaultResponse.completeHandler";
   }
   ajaxOptions.OnComplete = string.Format("defaultResponse.completeHandler(data,{0});", ajaxOptions.OnComplete);
 }
Exemplo n.º 30
0
    private static void ProcessAttributeHtmlForm(AjaxOptions ajaxOptions, IDictionary<string, object> newhtmlAttribute)
    {
      const string emptyFunction = "function(){}";
      var onsuccess = string.IsNullOrEmpty(ajaxOptions.OnSuccess) ? emptyFunction : ajaxOptions.OnSuccess;
      var oncomplete = string.IsNullOrEmpty(ajaxOptions.OnComplete) ? emptyFunction : ajaxOptions.OnComplete;
//      newhtmlAttribute.Add("onsubmit", string.Format("uploadHandler(this, new Sys.UI.DomEvent(event), {{onsuccess:{0}, oncomplete:{1} }})", onsuccess, oncomplete));
      newhtmlAttribute.Add("onsubmit", string.Format("uploadHandler(this, {{onsuccess:{0}, oncomplete:{1} }})", onsuccess, oncomplete));

    }
Exemplo n.º 31
0
        public static MvcHtmlString ActionLink(this AjaxHelper ajaxHelper, string linkText, string actionName, string controllerName, string protocol, string hostName, string fragment, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes) {
            if (String.IsNullOrEmpty(linkText)) {
                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "linkText");
            }

            string targetUrl = UrlHelper.GenerateUrl(null /* routeName */, actionName, controllerName, protocol, hostName, fragment, routeValues, ajaxHelper.RouteCollection, ajaxHelper.ViewContext.RequestContext, true /* includeImplicitMvcValues */);

            return MvcHtmlString.Create(GenerateLink(ajaxHelper, linkText, targetUrl, ajaxOptions, htmlAttributes));
        }
Exemplo n.º 32
0
        //图片按钮
        public static MvcHtmlString ImageLink(this AjaxHelper ajaxHelper, string linkText, string href, string src,
                                              System.Web.Mvc.Ajax.AjaxOptions ajaxOptions)
        {
            StringBuilder innerHtml = new StringBuilder();

            //img
            TagBuilder img = new TagBuilder("img");

            img.MergeAttribute("src", src);
            if (!string.IsNullOrEmpty(linkText))
            {
                img.MergeAttribute("title", linkText);
            }
            innerHtml.Append(img.ToString());

            ////span
            //if (linkText != null) {
            //    TagBuilder span = new TagBuilder("span");
            //    span.InnerHtml = linkText;
            //    innerHtml.Append(span.ToString());
            //}


            //a
            TagBuilder a = new TagBuilder("a");

            //AjaxOptions
            if (!string.IsNullOrEmpty(ajaxOptions.UpdateTargetId))
            {
                a.MergeAttribute("data-ajax-update", string.Format("#{0}", ajaxOptions.UpdateTargetId));
            }
            if (!string.IsNullOrEmpty(ajaxOptions.HttpMethod))
            {
                a.MergeAttribute("data-ajax-method", ajaxOptions.HttpMethod);
            }
            if (!string.IsNullOrEmpty(ajaxOptions.Confirm))
            {
                a.MergeAttribute("data-ajax-confirm", ajaxOptions.Confirm);
            }
            if (!string.IsNullOrEmpty(ajaxOptions.OnSuccess))
            {
                a.MergeAttribute("data-ajax-success", ajaxOptions.OnSuccess);
            }
            if (!string.IsNullOrEmpty(ajaxOptions.OnFailure))
            {
                a.MergeAttribute("data-ajax-failure", ajaxOptions.OnFailure);
            }
            a.MergeAttribute("data-ajax-mode", ajaxOptions.InsertionMode.ToString());
            a.MergeAttribute("data-ajax", "true");

            a.MergeAttribute("href", href);
            a.InnerHtml = innerHtml.ToString();
            return(MvcHtmlString.Create(a.ToString()));
        }
        public static ComponentBuilder <TConfig, FluentBootstrap.Buttons.LinkButton> AjaxLinkButton <TConfig, TComponent>(
            this BootstrapHelper <TConfig, TComponent> helper,
            string linkText,
            string href,
            string btnStyle = "btn-primary",
            System.Web.Mvc.Ajax.AjaxOptions ajaxOptions = null
            ) where TConfig : BootstrapConfig where TComponent : Component, ICanCreate <FluentBootstrap.Buttons.LinkButton>
        {
            ajaxOptions = ajaxOptions ?? new AjaxOptions()
            {
                OnSuccess = "indexViewModel.modalLoaded"
            };

            var link = helper.LinkButton(linkText, href).AddCss("btn", btnStyle)
                       .AddAttributes(ajaxOptions.ToUnobtrusiveHtmlAttributes());

            return(link);
        }
Exemplo n.º 34
0
 public static AjaxOptions Begin(this AjaxOptions ajaxOptions, string begin)
 {
     ajaxOptions.OnBegin = begin;
     return(ajaxOptions);
 }
Exemplo n.º 35
0
 public static AjaxOptions Target(this AjaxOptions ajaxOptions, string targetId)
 {
     ajaxOptions.UpdateTargetId = targetId;
     return(ajaxOptions);
 }
Exemplo n.º 36
0
 public static AjaxOptions Success(this AjaxOptions ajaxOptions, string success)
 {
     ajaxOptions.OnSuccess = success;
     return(ajaxOptions);
 }
Exemplo n.º 37
0
 public static AjaxOptions Get(this AjaxOptions ajaxOptions)
 {
     ajaxOptions.HttpMethod = "Get";
     return(ajaxOptions);
 }
Exemplo n.º 38
0
    public static MvcHtmlString ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actionName, object routeValues, System.Web.Mvc.Ajax.AjaxOptions ajaxOptions, object htmlAtributes)
    {
        var builder = new TagBuilder("img");

        builder.MergeAttribute("src", imageUrl);
        builder.MergeAttribute("alt", altText);
        var link = helper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions, htmlAtributes);

        return(MvcHtmlString.Create(
                   link.ToHtmlString().Replace("[replaceme]",
                                               string.Concat("<imgLabel>", altText, "</imgLabel>", builder.ToString(TagRenderMode.SelfClosing))
                                               )
                   ));
    }
Exemplo n.º 39
0
 public static AjaxOptions UpdateTargetId(this AjaxOptions ajaxOptions, string updateTargetId)
 {
     ajaxOptions.UpdateTargetId = updateTargetId;
     return(ajaxOptions);
 }
Exemplo n.º 40
0
 public static AjaxOptions Post(this AjaxOptions ajaxOptions)
 {
     ajaxOptions.HttpMethod = "POST";
     return(ajaxOptions);
 }
Exemplo n.º 41
0
 public static AjaxOptions Confirm(this AjaxOptions ajaxOptions, string message)
 {
     ajaxOptions.Confirm = message;
     return(ajaxOptions);
 }