2010-11-09 87 views
0

我正在开发一个asp.net mvc 2应用程序,并使用Html.TextAreaFor来显示一个textarea,用户可以在其中输入一个文本,然后根据需要存储和发送该文本。Html.TextAreaFor在asp.net mvc 2渲染错误!

显示此功能的视图是强类型的(typeof(Message))。该消息具有发送者,接收者,主题和消息主体。在视图中的代码看起来像这样 <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary(true) %> <fieldset style="height:100%"> <legend>E-mail</legend> <div class="editor-label"> <%: Html.LabelFor(model => model.To) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.To) %> <%: Html.ValidationMessageFor(model => model.To) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.From) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.From) %> <%: Html.ValidationMessageFor(model => model.From) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.Subject) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.Subject) %> <%: Html.ValidationMessageFor(model => model.Subject) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.Message) %> </div> <div class="editor-field"> <%: Html.TextAreaFor(model => model.Message) %> <%: Html.ValidationMessageFor(model => model.Message) %> </div> <p> <input type="submit" value="SaveMail" /> </p> </fieldset> <% } %>

当我在浏览器中打开此页面,然后提交按钮放置在textarea上,我不能让它呈现正确的...任何人的帮助?

+0

听起来更像我的HTML/CSS问题。你有链接到页面? – 2010-11-09 12:50:10

回答

1

看起来这是一些CSS问题。您是否尝试删除样式以查看它是否正确渲染?

+0

我对网络编程相当新颖,所以我在使用CSS时遇到了一些麻烦,但是在我的兄弟告诉我将
置于tetxarea之下后,它现在呈现良好......我会坚持一段时间,因为我想拥有所有准备及时,后来我会尝试获得CSS工作...感谢您的快速回复 – 2010-11-09 13:04:03

+3

@Ivan:告诉你的兄弟,他应该在StackOverflow上创建一个帐户。 – GvS 2010-11-09 13:09:35

+0

刚刚发现,如果我这样写它,它工作正常没有
'

<%: Html.EditorFor(model => model.Message) %> <%: Html.ValidationMessageFor(model => model.Message) %>
' keypart is class = multi-line – 2010-11-09 13:52:00