简体   繁体   中英

MVC2 C# TextAreaFor contains ', ,'

I am using MVC2 C#.

I have the following issue: if the !ModelState.IsValid, I send the user back to the invalid form where my textareas contain ',' or duplicates whatever is in the textarea.

<%=Html.TextAreaFor(x => x.Address, new { cols = 42, rows = 4 })%>
<%=Html.HiddenFor(x => x.Address)%> 

I pass this information inbetween forms, so I also have the value as a hidden at the bottom of the form, don't know another way of passing this information between forms (I have 8 forms in total which use 1 ViewModel).

I know the hidden is causing the issue but don't know how to fix it.

Thanks in advance for any help

Clare

I had duplicated the values by having hidden fields on my aspx page. Once removed the textareas no longer contained ', ,' when the page was refreshed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM