當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。