当前位置: 首页>>代码示例>>C#>>正文


C# AjaxOptions.ToUnobtrusiveHtmlAttributes方法代码示例

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


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

示例1: ToUnobtrusiveHtmlAttributesWithUpdateTargetIdAndExplicitInsertionMode

        public void ToUnobtrusiveHtmlAttributesWithUpdateTargetIdAndExplicitInsertionMode()
        {
            // Arrange
            AjaxOptions options = new AjaxOptions
            {
                InsertionMode = InsertionMode.InsertAfter,
                UpdateTargetId = "someId"
            };

            // Act
            var attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Equal(3, attributes.Count);
            Assert.Equal("true", attributes["data-ajax"]);
            Assert.Equal("#someId", attributes["data-ajax-update"]);
            Assert.Equal("after", attributes["data-ajax-mode"]);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:18,代码来源:AjaxOptionsTest.cs

示例2: ToUnobtrusiveHtmlAttributesEscapesClientSideIdentifiers

        public void ToUnobtrusiveHtmlAttributesEscapesClientSideIdentifiers(string id, string expected)
        {
            // Arrange
            AjaxOptions options = new AjaxOptions { UpdateTargetId = id, LoadingElementId = id };

            // Act
            var attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Equal(expected, attributes["data-ajax-update"]);
            Assert.Equal(expected, attributes["data-ajax-loading"]);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:12,代码来源:AjaxOptionsTest.cs

示例3: ToUnobtrusiveHtmlAttributesWithOnlyUpdateTargetId

        public void ToUnobtrusiveHtmlAttributesWithOnlyUpdateTargetId()
        {
            // Arrange
            AjaxOptions options = new AjaxOptions { UpdateTargetId = "someId" };

            // Act
            var attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Equal(3, attributes.Count);
            Assert.Equal("true", attributes["data-ajax"]);
            Assert.Equal("#someId", attributes["data-ajax-update"]);
            Assert.Equal("replace", attributes["data-ajax-mode"]); // Only added when UpdateTargetId is set
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:14,代码来源:AjaxOptionsTest.cs

示例4: ToUnobtrusiveHtmlAttributesWithAllowCache

        public void ToUnobtrusiveHtmlAttributesWithAllowCache()
        {
            // Arrange
            AjaxOptions options = new AjaxOptions
            {
                UpdateTargetId = "someId",
                HttpMethod = "GET",
                AllowCache = true,
                Url = "http://someurl.com",
                OnComplete = "some_complete_function"
            };

            // Act
            var attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Equal(7, attributes.Count);
            Assert.Equal("true", attributes["data-ajax"]);
            Assert.Equal("GET", attributes["data-ajax-method"]);
            Assert.Equal("http://someurl.com", attributes["data-ajax-url"]);
            Assert.Equal("#someId", attributes["data-ajax-update"]);
            Assert.Equal("true", attributes["data-ajax-cache"]);
            Assert.Equal("replace", attributes["data-ajax-mode"]);
            Assert.Equal("some_complete_function", attributes["data-ajax-complete"]);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:25,代码来源:AjaxOptionsTest.cs

示例5: ToUnobtrusiveHtmlAttributes

        public void ToUnobtrusiveHtmlAttributes()
        {
            // Arrange
            AjaxOptions options = new AjaxOptions
            {
                InsertionMode = InsertionMode.InsertBefore,
                Confirm = "confirm",
                HttpMethod = "POST",
                LoadingElementId = "loadingElement",
                LoadingElementDuration = 450,
                UpdateTargetId = "someId",
                Url = "http://someurl.com",
                OnBegin = "some_begin_function",
                OnComplete = "some_complete_function",
                OnFailure = "some_failure_function",
                OnSuccess = "some_success_function",
            };

            // Act
            var attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Equal(12, attributes.Count);
            Assert.Equal("true", attributes["data-ajax"]);
            Assert.Equal("confirm", attributes["data-ajax-confirm"]);
            Assert.Equal("POST", attributes["data-ajax-method"]);
            Assert.Equal("#loadingElement", attributes["data-ajax-loading"]);
            Assert.Equal(450, attributes["data-ajax-loading-duration"]);
            Assert.Equal("http://someurl.com", attributes["data-ajax-url"]);
            Assert.Equal("#someId", attributes["data-ajax-update"]);
            Assert.Equal("before", attributes["data-ajax-mode"]);
            Assert.Equal("some_begin_function", attributes["data-ajax-begin"]);
            Assert.Equal("some_complete_function", attributes["data-ajax-complete"]);
            Assert.Equal("some_failure_function", attributes["data-ajax-failure"]);
            Assert.Equal("some_success_function", attributes["data-ajax-success"]);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:36,代码来源:AjaxOptionsTest.cs

示例6: ToUnobtrusiveHtmlAttributesWithEmptyOptions

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

            // Act
            IDictionary<string, object> attributes = options.ToUnobtrusiveHtmlAttributes();

            // Assert
            Assert.Single(attributes);
            Assert.Equal("true", attributes["data-ajax"]);
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:12,代码来源:AjaxOptionsTest.cs


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