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


C# HtmlHelper.TextArea方法代码示例

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


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

示例1: TextAreaWithEmptyNameThrows

        public void TextAreaWithEmptyNameThrows() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act and assert
            ExceptionAssert.ThrowsArgumentException(() => helper.TextArea(null), "name", "Value cannot be null or an empty string.");

            // Act and assert
            ExceptionAssert.ThrowsArgumentException(() => helper.TextArea(String.Empty), "name", "Value cannot be null or an empty string.");
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:10,代码来源:TextAreaHelperTest.cs

示例2: TextAreaWithNonZeroRowsAndColumns

        public void TextAreaWithNonZeroRowsAndColumns() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextArea("foo", null, 4, 10, null);

            // Assert
            Assert.AreEqual(@"<textarea cols=""10"" id=""foo"" name=""foo"" rows=""4""></textarea>", html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:10,代码来源:TextAreaHelperTest.cs

示例3: TextAreaWithDefaultRowsAndCols

        public void TextAreaWithDefaultRowsAndCols() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act
            var html = helper.TextArea("foo");

            // Assert
            Assert.AreEqual(@"<textarea cols=""20"" id=""foo"" name=""foo"" rows=""2""></textarea>", html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:10,代码来源:TextAreaHelperTest.cs

示例4: TextAreaWithObjectAttributes

        public void TextAreaWithObjectAttributes() {
            // Arrange
            ModelStateDictionary modelState = new ModelStateDictionary();
            modelState.SetModelValue("foo", "foo-value");
            HtmlHelper helper = new HtmlHelper(modelState);

            // Act
            var html = helper.TextArea("foo", new { attr = "value", cols = 6 });

            // Assert
            Assert.AreEqual(@"<textarea attr=""value"" cols=""6"" id=""foo"" name=""foo"" rows=""2"">foo-value</textarea>", html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:12,代码来源:TextAreaHelperTest.cs

示例5: TextAreaWithDictionaryAttributes

        public void TextAreaWithDictionaryAttributes() {
            // Arrange
            ModelStateDictionary modelState = new ModelStateDictionary();
            modelState.SetModelValue("foo", "explicit-foo-value");
            HtmlHelper helper = new HtmlHelper(modelState);
            var attributes = new Dictionary<string, object>() { { "attr", "attr-val" }, { "rows", 15 }, { "cols", 12 } };
            // Act
            var html = helper.TextArea("foo", attributes);

            // Assert
            Assert.AreEqual(@"<textarea attr=""attr-val"" cols=""12"" id=""foo"" name=""foo"" rows=""15"">explicit-foo-value</textarea>", 
                html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:13,代码来源:TextAreaHelperTest.cs

示例6: TextAreaWithCustomErrorClass

        // [TestMethod]
        // Cant test this in multi-threaded
        public void TextAreaWithCustomErrorClass() {
            // Arrange
            ModelStateDictionary modelState = new ModelStateDictionary();
            modelState.AddError("foo", "some error");
            HtmlHelper.ValidationInputCssClassName = "custom-field-validation-error";
            HtmlHelper helper = new HtmlHelper(modelState);

            // Act
            var html = helper.TextArea("foo", String.Empty, new { @class = "my-css" });

            // Assert
            Assert.AreEqual(@"<textarea class=""custom-field-validation-error my-css"" cols=""20"" id=""foo"" name=""foo"" rows=""2""></textarea>",
                html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:16,代码来源:TextAreaHelperTest.cs

示例7: TextAreaWithError

        public void TextAreaWithError() {
            // Arrange
            ModelStateDictionary modelState = new ModelStateDictionary();
            modelState.AddError("foo", "some error");
            HtmlHelper helper = new HtmlHelper(modelState);

            // Act
            var html = helper.TextArea("foo", String.Empty);

            // Assert
            Assert.AreEqual(@"<textarea class=""field-validation-error"" cols=""20"" id=""foo"" name=""foo"" rows=""2""></textarea>",
                html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:13,代码来源:TextAreaHelperTest.cs

示例8: TextAreaWithNoValueAndObjectAttributes

        public void TextAreaWithNoValueAndObjectAttributes() {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());
            var attributes = new Dictionary<string, object>() { { "attr", "attr-val" }, { "rows", 15 }, { "cols", 12 } };
            // Act
            var html = helper.TextArea("foo", attributes);

            // Assert
            Assert.AreEqual(@"<textarea attr=""attr-val"" cols=""12"" id=""foo"" name=""foo"" rows=""15""></textarea>",
                html.ToHtmlString());
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:11,代码来源:TextAreaHelperTest.cs


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