2010-11-09 62 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