當前位置: 首頁>>代碼示例>>C#>>正文


C# AjaxOptions類代碼示例

本文整理匯總了C#中AjaxOptions的典型用法代碼示例。如果您正苦於以下問題:C# AjaxOptions類的具體用法?C# AjaxOptions怎麽用?C# AjaxOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AjaxOptions類屬於命名空間,在下文中一共展示了AjaxOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的AjaxOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。