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

C# AjaxOptions类代码示例

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

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



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

示例1: OnSuccessProperty

        public void OnSuccessProperty() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            MemberHelper.TestStringProperty(options, "OnSuccess", String.Empty, false, true);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs


示例2: InsertionModeProperty

        public void InsertionModeProperty() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            MemberHelper.TestEnumProperty(options, "InsertionMode", InsertionMode.Replace, false);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs


示例3: OnFailureProperty

        public void OnFailureProperty() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            MemberHelper.TestStringProperty(options, "OnFailure", String.Empty);
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:7,代码来源:AjaxOptionsTest.cs


示例4: HttpMethodProperty

        public void HttpMethodProperty() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            MemberHelper.TestStringProperty(options, "HttpMethod", String.Empty, false, true);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs


示例5: InsertionModePropertyExceptionText

        public void InsertionModePropertyExceptionText()
        {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            Assert.ThrowsArgumentOutOfRange(
                delegate { options.InsertionMode = (InsertionMode)4; },
                "value",
                @"Specified argument was out of the range of valid values.");
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:11,代码来源:AjaxOptionsTest.cs


示例6: InsertionModeUnobtrusiveTests

        public void InsertionModeUnobtrusiveTests(InsertionMode mode, string expected)
        {
            // Arrange
            AjaxOptions options = new AjaxOptions { InsertionMode = mode };

            // Act
            string result = options.InsertionModeUnobtrusive;
            
            // Assert
            Assert.Equal(expected, result);
        }
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:11,代码来源:AjaxOptionsTest.cs


示例7: ActionLinkAnonymousValues

        public void ActionLinkAnonymousValues() {
            // Arrange
            AjaxHelper helper = GetAjaxHelper();
            object values = new { controller = "Controller" };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            string actionLink = helper.ActionLink("Some Text", "Action", values, options);

            // Assert
            Assert.AreEqual(@"<a href=""" + HtmlHelperTest.AppPathModifier + @"/app/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxExtensionsTest.cs


示例8: InsertionModePropertyExceptionText

        public void InsertionModePropertyExceptionText() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            ExceptionHelper.ExpectArgumentOutOfRangeException(
                delegate {
                    options.InsertionMode = (InsertionMode)4;
                },
                "value",
                "The value '4' is outside the valid range of the enumeration type 'System.Web.Mvc.Ajax.InsertionMode'.\r\nParameter name: value");
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxOptionsTest.cs


示例9: InsertionModePropertyExceptionText

        public void InsertionModePropertyExceptionText() {
            // Arrange
            AjaxOptions options = new AjaxOptions();

            // Act & Assert
            ExceptionHelper.ExpectArgumentOutOfRangeException(
                delegate {
                    options.InsertionMode = (InsertionMode)4;
                },
                "value",
                @"Specified argument was out of the range of valid values.
Parameter name: value");
        }
开发者ID:consumentor,项目名称:Server,代码行数:13,代码来源:AjaxOptionsTest.cs


示例10: DisposeWritesClosingFormTag

        public void DisposeWritesClosingFormTag() {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper();
            AjaxOptions ajaxOptions = new AjaxOptions { UpdateTargetId = "some-id" };
            StringWriter writer = new StringWriter();
            ajaxHelper.ViewContext.Writer = writer;

            // Act
            IDisposable form = ajaxHelper.BeginForm("Action", "Controller", ajaxOptions);
            form.Dispose();

            // Assert
            Assert.IsTrue(writer.ToString().EndsWith("</form>"));
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:14,代码来源:AjaxExtensionsTest.cs


示例11: PagerBuilder

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


示例12: DisposeWritesClosingFormTag

        public void DisposeWritesClosingFormTag() {
            // Arrange
            Mock<HttpResponseBase> mockResponse = new Mock<HttpResponseBase>(MockBehavior.Strict);
            AjaxHelper ajaxHelper = GetAjaxHelper(mockResponse);
            AjaxOptions ajaxOptions = new AjaxOptions { UpdateTargetId = "some-id" };

            // Arrange expectations
            mockResponse.Expect(response => response.Write(AjaxFormWithTargetId)).Verifiable();
            mockResponse.Expect(response => response.Write(AjaxFormClose)).Verifiable();

            // Act
            IDisposable form = ajaxHelper.BeginForm("Action", "Controller", ajaxOptions);
            form.Dispose();

            // Assert
            mockResponse.Verify();
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:17,代码来源:AjaxExtensionsTest.cs


示例13: BeginRouteFormTypedValues_Unobtrusive

        public void BeginRouteFormTypedValues_Unobtrusive()
        {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper(unobtrusiveJavaScript: true);
            AjaxOptions ajaxOptions = new AjaxOptions();
            RouteValueDictionary values = new RouteValueDictionary();
            StringWriter writer = new StringWriter();
            ajaxHelper.ViewContext.Writer = writer;

            // Act
            IDisposable form = ajaxHelper.BeginRouteForm("namedroute", values, ajaxOptions);

            // Assert
            Assert.Equal(@"<form action=""" + MvcHelper.AppPathModifier + @"/app/named/home/oldaction"" data-ajax=""true"" method=""post"">", writer.ToString());
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:15,代码来源:AjaxExtensionsTest.cs


示例14: RouteLinkNamedRouteTypedValuesAndAttributes

        public void RouteLinkNamedRouteTypedValuesAndAttributes() {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper();
            RouteValueDictionary values = new RouteValueDictionary {
                { "controller", "Controller" },
                { "action", "Action" }
            };

            Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" } };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", values, options, htmlAttributes);

            // Assert
            Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""" + HtmlHelperTest.AppPathModifier + @"/app/named/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:17,代码来源:AjaxExtensionsTest.cs


示例15: RouteLinkWithHostName

        public void RouteLinkWithHostName() {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper();
            Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" } };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", null, "baz.bar.foo", null, null, options, htmlAttributes);

            // Assert
            Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""http://baz.bar.foo" + HtmlHelperTest.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxExtensionsTest.cs


示例16: ActionLinkControllerTypedValues_Unobtrusive

        public void ActionLinkControllerTypedValues_Unobtrusive()
        {
            // Arrange
            AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: true);
            RouteValueDictionary values = new RouteValueDictionary
            {
                { "id", 5 }
            };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            MvcHtmlString actionLink = helper.ActionLink("Some Text", "Action", "Controller", values, options);

            // Assert
            Assert.Equal(@"<a data-ajax=""true"" data-ajax-mode=""replace"" data-ajax-update=""#update-div"" href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action/5"">Some Text</a>", actionLink.ToHtmlString());
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:16,代码来源:AjaxExtensionsTest.cs


示例17: RouteLinkNamedRouteAnonymousAttributes

        public void RouteLinkNamedRouteAnonymousAttributes() {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper();
            object htmlAttributes = new {
                foo = "bar",
                baz = "quux"
            };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", options, htmlAttributes);

            // Assert
            Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""" + HtmlHelperTest.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:15,代码来源:AjaxExtensionsTest.cs


示例18: RouteLinkNamedRouteTypedAttributes

        public void RouteLinkNamedRouteTypedAttributes()
        {
            // Arrange
            AjaxHelper ajaxHelper = GetAjaxHelper(unobtrusiveJavaScript: false);
            Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" }, { "foo_bar", "baz_quux" } };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            MvcHtmlString actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", options, htmlAttributes);

            // Assert
            Assert.Equal(@"<a baz=""quux"" foo=""bar"" foo_bar=""baz_quux"" href=""" + MvcHelper.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: &#39;update-div&#39; });"">Some Text</a>", actionLink.ToHtmlString());
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:13,代码来源:AjaxExtensionsTest.cs


示例19: RouteLinkTypedValues

        public void RouteLinkTypedValues()
        {
            // Arrange
            AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: false);
            RouteValueDictionary values = new RouteValueDictionary
            {
                { "controller", "Controller" },
                { "action", "Action" }
            };

            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            MvcHtmlString actionLink = helper.RouteLink("Some Text", values, options);

            // Assert
            Assert.Equal(@"<a href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: &#39;update-div&#39; });"">Some Text</a>", actionLink.ToHtmlString());
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:18,代码来源:AjaxExtensionsTest.cs


示例20: RouteLinkTypedValuesAndAttributes_Unobtrusive

        public void RouteLinkTypedValuesAndAttributes_Unobtrusive()
        {
            // Arrange
            AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: true);
            RouteValueDictionary values = new RouteValueDictionary
            {
                { "controller", "Controller" },
                { "action", "Action" }
            };
            Dictionary<string, object> htmlAttributes = new Dictionary<string, object>
            {
                { "foo", "bar" },
                { "baz", "quux" },
                { "foo_bar", "baz_quux" }
            };
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };

            // Act
            MvcHtmlString actionLink = helper.RouteLink("Some Text", values, options, htmlAttributes);

            // Assert
            Assert.Equal(@"<a baz=""quux"" data-ajax=""true"" data-ajax-mode=""replace"" data-ajax-update=""#update-div"" foo=""bar"" foo_bar=""baz_quux"" href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action"">Some Text</a>", actionLink.ToHtmlString());
        }
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:23,代码来源:AjaxExtensionsTest.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AjaxRequestEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# AjaxControlToolkit类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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