Ejemplo n.º 1
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;

        }
Ejemplo n.º 2
0
			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));

			}
Ejemplo n.º 3
0
        //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;
        }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 public static MvcHtmlString ActionHtmlLink(this System.Web.Mvc.AjaxHelper ajax, string htmlText, string actionName, string controllerName, object routeValues,
                                            AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(MvcHtmlString.Create(ajax.ActionLink("[*AnchorText]", actionName, controllerName, routeValues, ajaxOptions, htmlAttributes)
                                 .ToString().Replace("[*AnchorText]", htmlText)
                                 ));
 }
 public void ConstructorWithNullViewDataContainerThrows() {
     // Assert
     ExceptionHelper.ExpectArgumentNullException(
         delegate {
             AjaxHelper ajaxHelper = new AjaxHelper(new Mock<ViewContext>().Object, null);
         },
         "viewDataContainer");
 }
 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;
 }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
0
   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(); }"
     });
 }
Ejemplo n.º 11
0
 ///<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;
 }
Ejemplo n.º 12
0
 /// <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;
 }
Ejemplo n.º 13
0
        /// <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;
        }
Ejemplo n.º 14
0
 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;
 }
Ejemplo n.º 15
0
        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();
        }
Ejemplo n.º 16
0
        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));
        }
        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)));
        }
        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);
        }
Ejemplo n.º 19
0
 // 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;
 }
Ejemplo n.º 20
0
        internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
            int totalPageCount, int pageIndex, int totalItemCount, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
            AjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
        {
            _msAjaxPaging = (ajax != null);
            if (String.IsNullOrEmpty(actionName))
            {
                if (ajax != null)
                    actionName = (string)ajax.ViewContext.RouteData.Values["action"];
                else
                    actionName = (string)html.ViewContext.RouteData.Values["action"];
            }
            if (String.IsNullOrEmpty(controllerName))
            {
                if (ajax != null)
                    controllerName = (string)ajax.ViewContext.RouteData.Values["controller"];
                else
                    controllerName = (string)html.ViewContext.RouteData.Values["controller"];
            }
            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;
            _totalItemCount = totalItemCount;
            _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;
        }
        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);
        }
Ejemplo n.º 22
0
        /// <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"));
        }
Ejemplo n.º 23
0
        public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<String, object> htmlAttributes)
        {
            _msAjaxPaging = (default(AjaxHelper) != ajaxHelper);

            if (actionName.IsNullOrEmpty())
            {
                actionName = _msAjaxPaging
                    ? (String) ajaxHelper.ViewContext.RouteData.Values["action"]
                    : (String) htmlHelper.ViewContext.RouteData.Values["action"];
            }
            if (controllerName.IsNullOrEmpty())
            {
                controllerName = _msAjaxPaging
                    ? (String) ajaxHelper.ViewContext.RouteData.Values["controller"]
                    : (String) htmlHelper.ViewContext.RouteData.Values["controller"];
            }

            if (null == pagerOptions) pagerOptions = new PagerOptions();

            _htmlHelper = htmlHelper;
            _ajaxHelper = ajaxHelper;
            _actionName = actionName;
            _controllerName = controllerName;
            _NoOfPages = noOfPages;
            _pageIndex = pageIndex;
            _pagerOptions = pagerOptions;
            _routeName = routeName;
            _routeValues = routeValues;
            _ajaxOptions = ajaxOptions;
            _htmlAttributes = htmlAttributes;

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

            // end page index
            _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
            if (_endPageIndex > _NoOfPages) _endPageIndex = _NoOfPages;
        }
Ejemplo n.º 24
0
		public CsAjaxForm(AjaxHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, RouteValueDictionary routeValueDictionary = null, bool autoOpen = true) : base(helper)
		{
			Id = GetUniqueId();
			LoadingId = GetUniqueId();



			_autoOpen = autoOpen;
			_container = new TagBuilder("div");
			_container.MergeAttribute("style", "position:relative;");


			_ajaxForm = new TagBuilder("form");
			_ajaxForm.GenerateId(Id);
			_ajaxForm.AddCssClass("cs-ajax");
			_ajaxForm.MergeAttribute("action", Url.Action(action, controller, routeValueDictionary));
			_ajaxForm.MergeAttribute("data-ajax", "true");
			_ajaxForm.MergeAttribute("data-ajax-loading", $"#{LoadingId}");
			_ajaxForm.MergeAttribute("data-ajax-loading-duration", $"200");
			_ajaxForm.MergeAttribute("data-ajax-method", $"Post");
			_ajaxForm.MergeAttribute("data-ajax-mode", $"replace");
			_ajaxForm.MergeAttribute("data-ajax-success", $"$.validator.unobtrusive.parse($('#{Id}'));");
			_ajaxForm.MergeAttribute("data-ajax-update", $"#{Id}");
			_ajaxForm.MergeAttribute("method", $"post");

			_loadingDiv = new TagBuilder("div");
			_loadingDiv.GenerateId(LoadingId);
			_loadingDiv.AddCssClass("cs-ajax-overlay");

			_clearDiv = new TagBuilder("div");
			_clearDiv.AddCssClass("clearfix");


			
			if (_autoOpen)
				Begin();



		}
        public static MvcHtmlString CustomActionLink(this AjaxHelper ajax,
            string linkText,
            string actionName,
            string controllerName,
          //  RouteValueDictionary routeValues=null, 
            object routeValues=null,
            object htmlAttributes = null,
            string updateTargetId = "content",
            string loadingElementId = "loading-indicator"
            )
        {
            //TagBuilder tag = new TagBuilder("a");
            //tag.MergeAttribute("data-ajax","true");
            //tag.MergeAttribute("data-ajax-mode", "replace");
            //tag.MergeAttribute("data-ajax-update", updateTargetId);
            //tag.MergeAttribute("data-ajax-loading", loadingElementId);
            //string url = UrlHelper.GenerateUrl("Default", actionName, controllerName, routeValues, html.RouteCollection,
            //html.ViewContext.RequestContext, true);//RouteTable.Routes
            //tag.MergeAttribute("href", url);
            //tag.InnerHtml = linkText;
            //return new MvcHtmlString(tag.ToString());
            AjaxOptions ajaxOptions = new AjaxOptions()
            {
                LoadingElementId = loadingElementId,
                UpdateTargetId = updateTargetId
            };

            AjaxHelper ajaxHelper = new AjaxHelper(ajax.ViewContext, ajax.ViewDataContainer);
            return ajaxHelper.ActionLink(linkText, actionName, controllerName, routeValues, ajaxOptions, htmlAttributes);

            //var ajaxAttributes = new
            //{
            //    "data-ajax" = "true",
            //    data-ajax-mode = "replace",
            //    data-ajax-update = updateTargetId,
            //    data-ajax-loading = loadingElementId
            //};

            //return html.ActionLink(linkText, actionName, controllerName, routeValues).;
        }
Ejemplo n.º 26
0
 public static MvcHtmlString ActionLink(this AjaxHelper ajaxHelper, string linkText, ActionResult result, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(ajaxHelper.RouteLink(linkText, result.GetRouteValueDictionary(), ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
Ejemplo n.º 27
0
 public static MvcForm BeginForm(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(BeginForm(ajaxHelper, result, ajaxOptions, new RouteValueDictionary(htmlAttributes)));
 }
Ejemplo n.º 28
0
 public static MvcHtmlString ActionLink <TActionResult>(this AjaxHelper ajaxHelper, string linkText, Task <TActionResult> taskResult, AjaxOptions ajaxOptions, object htmlAttributes) where TActionResult : ActionResult
 {
     return(T4Extensions.ActionLink(ajaxHelper, linkText, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 29
0
 public static MvcHtmlString ActionLink(this AjaxHelper ajaxHelper, string linkText, Task <ActionResult> taskResult, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(ajaxHelper.ActionLink(linkText, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 30
0
 public static MvcForm BeginRouteForm <TActionResult>(this AjaxHelper ajaxHelper, string routeName, Task <TActionResult> taskResult, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes) where TActionResult : ActionResult
 {
     return(T4Extensions.BeginRouteForm(ajaxHelper, routeName, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 31
0
 public static MvcHtmlString RouteLink <TActionResult>(this AjaxHelper ajaxHelper, string linkText, string routeName, Task <TActionResult> taskResult, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes) where TActionResult : ActionResult
 {
     return(T4Extensions.RouteLink(ajaxHelper, linkText, routeName, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 32
0
        public static MvcForm BeginForm(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
        {
            var callInfo = result.GetT4MVCResult();

            return(ajaxHelper.BeginForm(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary, ajaxOptions, htmlAttributes));
        }
Ejemplo n.º 33
0
 protected virtual void CreateHelpers()
 {
     Html = new HtmlHelper(ViewContext, this);
         Url = new UrlHelper(ViewContext.RequestContext);
         Ajax = new AjaxHelper(ViewContext, this);
 }
Ejemplo n.º 34
0
 public static MvcHtmlString RouteLink(this AjaxHelper ajaxHelper, string linkText, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(ajaxHelper.RouteLink(linkText, routeName, taskResult.Result, ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
Ejemplo n.º 35
0
 public static MvcForm BeginRouteForm(this AjaxHelper ajaxHelper, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions)
 {
     return(ajaxHelper.BeginRouteForm(routeName, taskResult.Result, ajaxOptions, null));
 }
Ejemplo n.º 36
0
 protected override void CreateHelpers(ViewContext viewContext)
 {
     Ajax = new AjaxHelper(viewContext, this);
     Html = new HtmlHelper(viewContext, this);
     Url  = new BooUrlHelper(viewContext.RequestContext);
 }
Ejemplo n.º 37
0
 public static MvcHtmlString RouteLink(this AjaxHelper ajaxHelper, string linkText, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
 {
     return(ajaxHelper.RouteLink(linkText, routeName, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 38
0
 public static MvcForm BeginForm(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(BeginForm(ajaxHelper, result, ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
Ejemplo n.º 39
0
 public static MvcForm BeginRouteForm(this AjaxHelper ajaxHelper, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     return(ajaxHelper.BeginRouteForm(routeName, taskResult.Result, ajaxOptions, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
Ejemplo n.º 40
0
 //Microsoft Ajax pager builder
 public PagerBuilder(AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<String, object> htmlAttributes)
     : this(null, ajaxHelper, actionName, controllerName, noOfPages, pageIndex, pagerOptions, routeName, routeValues, ajaxOptions, htmlAttributes)
 {
 }
Ejemplo n.º 41
0
 private static MvcHtmlString Pager(AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
 {
     return new PagerBuilder(null, ajax, pagerOptions, htmlAttributes).RenderPager();
 }
Ejemplo n.º 42
0
 public static MvcForm BeginForm(this AjaxHelper ajaxHelper, ActionResult result, AjaxOptions ajaxOptions)
 {
     return(ajaxHelper.BeginForm(result, ajaxOptions, null));
 }
        private static AjaxHelper GetAjaxHelper(Mock<HttpResponseBase> mockResponse) {
            HttpContextBase httpcontext = GetHttpContext("/app/", mockResponse);
            RouteCollection rt = new RouteCollection();
            rt.Add(new Route("{controller}/{action}/{id}", null) { Defaults = new RouteValueDictionary(new { id = "defaultid" }) });
            rt.Add("namedroute", new Route("named/{controller}/{action}/{id}", null) { Defaults = new RouteValueDictionary(new { id = "defaultid" }) });
            RouteData rd = new RouteData();
            rd.Values.Add("controller", "home");
            rd.Values.Add("action", "oldaction");

            Mock<ViewContext> mockViewContext = new Mock<ViewContext>();
            mockViewContext.Expect(c => c.HttpContext).Returns(httpcontext);
            mockViewContext.Expect(c => c.RouteData).Returns(rd);
            AjaxHelper ajaxHelper = new AjaxHelper(mockViewContext.Object, new Mock<IViewDataContainer>().Object, rt);
            return ajaxHelper;
        }
Ejemplo n.º 44
0
 public virtual void InitHelpers()
 {
     Ajax = new AjaxHelper <object>(ViewContext, this);
     Html = new HtmlHelper <object>(ViewContext, this);
     Url  = new UrlHelper(ViewContext.RequestContext);
 }
Ejemplo n.º 45
0
 //Microsoft Ajax pager builder
 internal PagerBuilder(AjaxHelper helper, string actionName, string controllerName, int totalPageCount,
     int pageIndex, int totalItemCount, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
     AjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
     : this(null, helper, actionName,
         controllerName, totalPageCount, pageIndex, totalItemCount, pagerOptions, routeName, routeValues, ajaxOptions, htmlAttributes) { }
Ejemplo n.º 46
0
 public static MvcForm BeginRouteForm(this AjaxHelper ajaxHelper, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
 {
     return(ajaxHelper.BeginRouteForm(routeName, taskResult.Result, ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 47
0
 public static MvcHtmlString RouteLink(this AjaxHelper ajaxHelper, string linkText, string routeName, Task <ActionResult> taskResult, AjaxOptions ajaxOptions)
 {
     return(ajaxHelper.RouteLink(linkText, routeName, taskResult.Result, ajaxOptions, null));
 }
Ejemplo n.º 48
0
 public static MvcForm BeginForm(this AjaxHelper ajaxHelper, Task <ActionResult> taskResult, AjaxOptions ajaxOptions)
 {
     return(ajaxHelper.BeginForm(taskResult.Result, ajaxOptions, null));
 }
Ejemplo n.º 49
0
 public static MvcForm BeginRouteForm(this AjaxHelper ajaxHelper, string routeName, ActionResult result, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
 {
     return(ajaxHelper.BeginRouteForm(routeName, result.GetRouteValueDictionary(), ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 50
0
 public static MvcHtmlString ActionLink(this AjaxHelper ajaxHelper, string linkText, ActionResult result, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
 {
     return(ajaxHelper.RouteLink(linkText, result.GetRouteValueDictionary(), ajaxOptions, htmlAttributes));
 }
Ejemplo n.º 51
0
 public virtual void InitHelpers()
 {
     Ajax = new AjaxHelper<object>(ViewContext, this);
     Html = new HtmlHelper<object>(ViewContext, this);
     Url = new UrlHelper(ViewContext.RequestContext);
 }
Ejemplo n.º 52
0
 public static string ActionLink(this AjaxHelper ajaxHelper, string linkText, ActionResult result, AjaxOptions ajaxOptions)
 {
     return(ajaxHelper.RouteLink(linkText, result.GetRouteValueDictionary(), ajaxOptions));
 }