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

C# Mvc.AjaxHelper类代码示例

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

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



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

示例1: PagerBuilder

        //Ajax pager builder
        internal PagerBuilder(AjaxHelper ajaxHelper, int totalPageCount, int pageIndex, PagerOptions pagerOptions,
            MvcAjaxOptions ajaxOptions)
        {
            _ajaxPagingEnabled =true;
            if (ajaxHelper == null)
            {
                throw new ArgumentNullException("ajaxHelper");
            }
            if (pagerOptions == null)
                pagerOptions = new PagerOptions();
            _ajax = ajaxHelper;
            if (pagerOptions.MaximumPageNumber == 0 || pagerOptions.MaximumPageNumber > totalPageCount)
                _totalPageCount = totalPageCount;
            else
                _totalPageCount = pagerOptions.MaximumPageNumber;
            _pageIndex = pageIndex;
            _pagerOptions = pagerOptions;
            _ajaxOptions = ajaxOptions ?? new MvcAjaxOptions();

            // start page index
            _startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
            if (_startPageIndex + pagerOptions.NumericPagerItemCount > _totalPageCount)
                _startPageIndex = _totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
            if (_startPageIndex < 1)
                _startPageIndex = 1;

            // end page index
            _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
            if (_endPageIndex > _totalPageCount)
                _endPageIndex = _totalPageCount;
        }
开发者ID:wlclass,项目名称:MvcPager,代码行数:32,代码来源:PagerBuilder.cs


示例2: PagerBuilder

 internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
     int totalPageCount, int pageIndex, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
     MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
 {
     _ajaxPagingEnabled = (ajax != null);
     if (pagerOptions == null)
         pagerOptions = new PagerOptions();
     _html = html;
     _ajax = ajax;
     _actionName = actionName;
     _controllerName = controllerName;
     if (pagerOptions.MaxPageIndex == 0 || pagerOptions.MaxPageIndex > totalPageCount)
         _totalPageCount = totalPageCount;
     else
         _totalPageCount = pagerOptions.MaxPageIndex;
     _pageIndex = pageIndex;
     _pagerOptions = pagerOptions;
     _routeName = routeName;
     _routeValues = routeValues;
     _ajaxOptions = ajaxOptions;
     _htmlAttributes = htmlAttributes;
     // start page index
     _startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
     if (_startPageIndex + pagerOptions.NumericPagerItemCount > _totalPageCount)
         _startPageIndex = _totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
     if (_startPageIndex < 1)
         _startPageIndex = 1;
     // end page index
     _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
     if (_endPageIndex > _totalPageCount)
         _endPageIndex = _totalPageCount;
 }
开发者ID:jasonoiu,项目名称:OIU.CorporateWebsite,代码行数:32,代码来源:PagerBuilder.cs


示例3: 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


示例4: GroupBox

			public GroupBox(AjaxHelper ajax, string headerText, string loader)
			{
				_ajax = ajax;

				if (IsAjax)
					return;

				_groupDiv = new TagBuilder("div");
				var headerDiv = new TagBuilder("div");
				_contentDiv = new TagBuilder("div");
				_loadingDiv = new TagBuilder("div");

				_groupDiv.AddCssClass("card");
				headerDiv.AddCssClass("card-header");
				_contentDiv.AddCssClass("card-block");
				_contentDiv.Attributes.Add("style", "position:relative;");
				_loadingDiv.AddCssClass("ajax-overlay");
				_loadingDiv.GenerateId(loader);

				headerDiv.SetInnerText(headerText);


				Write(_groupDiv.ToString(TagRenderMode.StartTag));
				Write(headerDiv.ToString());
				
				Write(_contentDiv.ToString(TagRenderMode.StartTag));

			}
开发者ID:cssack,项目名称:CsGlobals,代码行数:28,代码来源:AjaxExtensions.cs


示例5: 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


示例6: InitHelpers

 public override void InitHelpers()
 {
     Ajax = new AjaxHelper<object>(ViewContext, this);
     Html = new DnnHtmlHelper<object>(ViewContext, this);
     Url = new DnnUrlHelper(ViewContext);
     Dnn = new DnnHelper<object>(ViewContext, this);
     ConferenceModuleContext = new ContextHelper(ViewContext);
 }
开发者ID:EPTamminga,项目名称:Conference,代码行数:8,代码来源:ConferenceWebPage.cs


示例7: AjaxPager

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


示例8: ConstructorWithNullViewDataContainerThrows

 public void ConstructorWithNullViewDataContainerThrows() {
     // Assert
     ExceptionHelper.ExpectArgumentNullException(
         delegate {
             AjaxHelper ajaxHelper = new AjaxHelper(new Mock<ViewContext>().Object, null);
         },
         "viewDataContainer");
 }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:8,代码来源:AjaxHelperTest.cs


示例9: AjaxPager

 ///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/AjaxPager/Constructor[@name="AjaxPager1"]/*'/>
 public AjaxPager(AjaxHelper ajax, int totalItemCount, int pageSize, int pageIndex,PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions)
 {
     _ajaxHelper = ajax;
     _totalItemCount = totalItemCount;
     _pageSize = pageSize;
     _currentPageIndex = pageIndex;
     _pagerOptions = pagerOptions;
     _ajaxOptions = ajaxOptions;
 }
开发者ID:wlclass,项目名称:MvcPager,代码行数:10,代码来源:AjaxPager.cs


示例10: PagerBuilder

 /// <summary>
 /// 适用于PagedList为null时
 /// </summary>
 internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
 {
     if (pagerOptions == null)
         pagerOptions = new PagerOptions();
     _html = html;
     _ajax = ajax;
     _pagerOptions = pagerOptions;
     _htmlAttributes = htmlAttributes;
 }
开发者ID:chunlei,项目名称:QrF,代码行数:12,代码来源:PagerBuilder.cs


示例11: DeleteLink

   public static MvcHtmlString DeleteLink(AjaxHelper ajaxHelper, string linkText, string actionName, object routeValues)
 {
     return ajaxHelper.ActionLink(linkText, actionName, routeValues, new AjaxOptions
     {
         Confirm = "Are you sure you want to delete this item?",
         HttpMethod = "DELETE",
         OnSuccess = "function() { window.location.reload(); }"
     });
 }
开发者ID:Haimanot1989,项目名称:ASP.Net,代码行数:9,代码来源:BaseController.cs


示例12: AjaxPager

 public AjaxPager(AjaxHelper helper, ViewContext viewContext, int pageSize, int currentPage, int totalItemCount, AjaxOptions options, RouteValueDictionary valueDictionary)
 {
     this.ajaxHelper = helper;
     this.viewContext = viewContext;
     this.pageSize = pageSize;
     this.currentPage = currentPage;
     this.totalItemCount = totalItemCount;
     this.ajaxOptions = options;
     this.linkWithoutPageValuesDictionary = valueDictionary;
 }
开发者ID:hamedAly,项目名称:thuong-nghiep,代码行数:10,代码来源:AjaxPager.cs


示例13: HtmlHelper

        void IBlock.RenderBlock(ViewContext viewContext)
        {
            ViewData = viewContext.ViewData;
            ViewContext = viewContext;
            Html = new HtmlHelper(viewContext, this);
            Ajax = new AjaxHelper(viewContext, this);
            Url = new UrlHelper(viewContext.RequestContext);

            RenderBlock();
        }
开发者ID:Eilon,项目名称:spark,代码行数:10,代码来源:BlockBase.cs


示例14: PagerBuilder

        /// <summary>
        /// used when PagedList is null
        /// </summary>
        public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, PagerOptions pagerOptions, IDictionary<String, object> htmlAttributes)
        {
            if (default(PagerOptions) == pagerOptions) pagerOptions = new PagerOptions();

            _msAjaxPaging = (default(AjaxHelper) != ajaxHelper);
            _htmlHelper = htmlHelper;
            _ajaxHelper = ajaxHelper;
            _pagerOptions = pagerOptions;
            _htmlAttributes = htmlAttributes;
        }
开发者ID:erashid,项目名称:Extensions,代码行数:13,代码来源:PagerBuilder.cs


示例15: ComposeImageActionLink

        private static MvcHtmlString ComposeImageActionLink(AjaxHelper helper, string imageUrl, string altText,
		                                                    string actionName, string controllerName, object routeValues,
		                                                    AjaxOptions ajaxOptions, object htmlAttributes = null)
        {
            var builder = new TagBuilder("img");
            builder.MergeAttribute("src", imageUrl);
            builder.MergeAttribute("alt", altText);
            string link =
                helper.ActionLink("[replaceme]", actionName, controllerName, routeValues, ajaxOptions, htmlAttributes).ToHtmlString();
            return new MvcHtmlString(link.Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)));
        }
开发者ID:vituniversitycse,项目名称:ClinicalStudy,代码行数:11,代码来源:AjaxActionHelper.cs


示例16: InitHelpers

        public override void InitHelpers()
        {
            ModuleRequestResult app = ViewContext.HttpContext.GetActiveModule();
            if(app == null) {
                base.InitHelpers();
            }

            Ajax = new AjaxHelper(ViewContext, this, ModuleRouteRewriter.CreateRouteCollection(app.Application.Routes));
            Html = new HtmlHelper(ViewContext, this, ModuleRouteRewriter.CreateRouteCollection(app.Application.Routes));
            Url = new UrlHelper(ViewContext.RequestContext, ModuleRouteRewriter.CreateRouteCollection(app.Application.Routes));
        }
开发者ID:anurse,项目名称:MaVeriCk,代码行数:11,代码来源:ModuleViewPage.cs


示例17: ConstructorSetsProperties1

        public void ConstructorSetsProperties1() {
            // Arrange
            ViewContext viewContext = new Mock<ViewContext>().Object;
            IViewDataContainer vdc = new Mock<IViewDataContainer>().Object;

            // Act
            AjaxHelper ajaxHelper = new AjaxHelper(viewContext, vdc);

            // Assert
            Assert.AreEqual(viewContext, ajaxHelper.ViewContext);
            Assert.AreEqual(vdc, ajaxHelper.ViewDataContainer);
            Assert.AreEqual(RouteTable.Routes, ajaxHelper.RouteCollection);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:13,代码来源:AjaxHelperTest.cs


示例18: PagerBuilder

 // Methods
 internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
 {
     this.totalPageCountGang = 1;
     this.startPageIndexGang = 1;
     this.endPageIndex = 1;
     if (pagerOptions == null)
     {
         pagerOptions = new PagerOptions();
     }
     this.htmlGang = html;
     this.ajaxGang = ajax;
     this.pagerOpitonGang = pagerOptions;
     this.htmlAttributesGang = htmlAttributes;
 }
开发者ID:HelloAmy,项目名称:01component,代码行数:15,代码来源:PagerBuilder.cs


示例19: GenericHelperConstructorSetsProperties1

        public void GenericHelperConstructorSetsProperties1() {
            // Arrange
            ViewContext viewContext = new Mock<ViewContext>().Object;
            ViewDataDictionary<Controller> vdd = new ViewDataDictionary<Controller>(new Mock<Controller>().Object);
            Mock<IViewDataContainer> vdc = new Mock<IViewDataContainer>();
            vdc.Expect(v => v.ViewData).Returns(vdd);

            // Act
            AjaxHelper<Controller> ajaxHelper = new AjaxHelper<Controller>(viewContext, vdc.Object);

            // Assert
            Assert.AreEqual(viewContext, ajaxHelper.ViewContext);
            Assert.AreEqual(vdc.Object, ajaxHelper.ViewDataContainer);
            Assert.AreEqual(RouteTable.Routes, ajaxHelper.RouteCollection);
            Assert.AreEqual(vdd.Model, ajaxHelper.ViewData.Model);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:16,代码来源:AjaxHelperTest.cs


示例20: GenerateFullCaptcha

        /// <summary>
        /// Create full captcha
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        internal static MvcHtmlString GenerateFullCaptcha(HtmlHelper htmlHelper, int length)
        {
            var encryptorModel = GetEncryptorModel();
            var captchaText = RandomText.Generate(length);
            var encryptText = Encryption.Encrypt(captchaText, encryptorModel.Password, encryptorModel.Salt);

            var urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);
            var url = urlHelper.Action("Create", "CaptchaImage", new { encryptText});

            var ajax = new AjaxHelper(htmlHelper.ViewContext, htmlHelper.ViewDataContainer);
            var refresh = ajax.ActionLink("Refresh", "NewCaptcha", "CaptchaImage", new {l = length},
                                          new AjaxOptions { UpdateTargetId = "CaptchaDeText", OnSuccess = "Success" });

            return MvcHtmlString.Create(string.Format(CaptchaFormat, url, htmlHelper.Hidden("CaptchaDeText", encryptText)) +
                                         refresh.ToHtmlString() + " <br/>Enter symbol: " +
                                        htmlHelper.TextBox("CaptchaInputText"));
        }
开发者ID:khoainv,项目名称:Framework,代码行数:23,代码来源:CaptchaHelper.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Mvc.AreaRegistrationContext类代码示例发布时间:2022-05-26
下一篇:
C# Mvc.ActionResult类代码示例发布时间: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