• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Ajax.AjaxOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



AjaxOptions类属于System.Web.Mvc.Ajax命名空间,在下文中一共展示了AjaxOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RawActionLink

        // 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));
        }
开发者ID:marindraganov,项目名称:LikeIt,代码行数:8,代码来源:HtmlHelperExtensions.cs


示例2: AjaxPager

 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);
 }
开发者ID:JPomichael,项目名称:IPOW,代码行数:7,代码来源:PagerHelper.cs


示例3: ActionLinkTo

 /// <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);
 }
开发者ID:MichalLasak,项目名称:megazlonet,代码行数:33,代码来源:AjaxHelpers.cs


示例4: InputActionLink

 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;
 }
开发者ID:kenwarner,项目名称:scrilla,代码行数:7,代码来源:HtmlHelpers.cs


示例5: PagingNavigator

        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());
        }
开发者ID:BSBYarek,项目名称:_TY_REP,代码行数:28,代码来源:Paging.cs


示例6: ActionLink

        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);
        }
开发者ID:mhinze,项目名称:msmvc,代码行数:7,代码来源:AjaxExtensions.cs


示例7: SortableColumnHeader

        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();
        }
开发者ID:robkobobko,项目名称:TicketDesk,代码行数:27,代码来源:SortableColumnHeader.cs


示例8: ImageActionLink

        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);
        }
开发者ID:vituniversitycse,项目名称:ClinicalStudy,代码行数:7,代码来源:AjaxActionHelper.cs


示例9: IconActionLink

 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()));
 }
开发者ID:LucasMitsuo,项目名称:Qlivros,代码行数:7,代码来源:ActionLinkExtension.cs


示例10: GenerateAjaxScript

        private static string GenerateAjaxScript(AjaxOptions ajaxOptions, string scriptFormat)
        {
            var ajaxOptionsHelper = new AjaxOptionsHelper(ajaxOptions);
            string optionsString = ajaxOptionsHelper.ToJavascriptString();

            return String.Format(CultureInfo.InvariantCulture, scriptFormat, optionsString);
        }
开发者ID:glacasa,项目名称:MvcHtmlLink,代码行数:7,代码来源:HtmlLink.cs


示例11: PagerBuilder

        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;

        }
开发者ID:robkobobko,项目名称:TicketDesk,代码行数:33,代码来源:PagerBuilder.cs


示例12: BeginPostForm

        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;
        }
开发者ID:tmccord123,项目名称:TMCDev,代码行数:26,代码来源:AjaxHelperExtension.cs


示例13: RawAjaxActionLink

 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));
 }
开发者ID:DesislavaPetkova,项目名称:Tweeter-App,代码行数:7,代码来源:LinkHellpersExtensions.cs


示例14: DisplayNameForSort

        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);
            }
        }
开发者ID:dfensgmbh,项目名称:biz.dfch.CS.Appclusive.UI,代码行数:34,代码来源:AjaxHelperExtensions.cs


示例15: PagingRouteValue

 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;
 }
开发者ID:enclaveTeam,项目名称:Portal.eCommerces,代码行数:8,代码来源:PagingGeneratorOption.cs


示例16: AjaxPager

 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);
 }
开发者ID:HelloAmy,项目名称:01component,代码行数:8,代码来源:PagerHelper.cs


示例17: BootstrapActionLink

 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;
 }
开发者ID:joypipi,项目名称:TwitterBootstrapMvc,代码行数:8,代码来源:BootstrapActionLink.cs


示例18: IconActionLink

 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)));
 }
开发者ID:dfensgmbh,项目名称:biz.dfch.CS.Appclusive.UI,代码行数:8,代码来源:AjaxHelperExtensions.cs


示例19: RawActionLink

 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));
 }
开发者ID:armaduk,项目名称:Stacks,代码行数:8,代码来源:HelperExtensions.cs


示例20: ImageActionLink

        /// <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)));
        }
开发者ID:Bowman74,项目名称:Badge-Application,代码行数:19,代码来源:ImageActionLinkExtensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Test.MockBuildManager类代码示例发布时间:2022-05-26
下一篇:
C# Mvc.ViewResult类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap