Inside my Model I have this code:
[Required(ErrorMessage = "News content is required.")]
[DisplayName("News Content")]
[DataType(DataType.MultilineText)]
public string FullContent { get; set; }
[Required(ErrorMessage = "News summary is required.")]
[DisplayName("News Summary")]
[DataType(DataType.MultilineText)]
public string Summary { get; set; }
And inside the View is:
<tr>
<td id="td-caption">Full Content</td>
<td id="td-content2">@Html.EditorFor(model => model.FullContent) @Html.ValidationMessageFor(model => model.FullContent)</td>
</tr>
<tr>
<td id="td-caption">Summary</td>
<td id="td-content2">@Html.EditorFor(model => model.Summary)@Html.ValidationMessageFor(model => model.Summary)</td>
</tr>
And inside my CSS:
textarea#FullContent, #Summary
{
width: 95%;
padding-top: 20px;
padding-left: 20px;
cols: 20;
rows: 20;
}
But no effect at all. What should I do? Thanks!
rowsandcolsare not valid CSS rules. They are attributes on thetextareaelement. But since you are using enEditorForhelper you cannot set their values. You could use thewidthandheightproperties in your CSS to adjust the size of the textarea: