Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8268101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:45:31+00:00 2026-06-08T05:45:31+00:00

I am trying to create a form which has a TextAreaFor email addresses. There

  • 0

I am trying to create a form which has a TextAreaFor email addresses. There are email addresses stored in a database. I want these stored addresses to be the default value of the field, and then allow the user to add or remove addresses from the list as they see fit.

My viewModel;

public List<string> EmailAddresses { get; set; }

My View:

<%= Html.TextAreaFor(m => m.EmailAddresses) %>

(this is wrong, as it displays System.Collections.Generic.List1[System.String]` in the input field rather than each item in the list.

I know I can iterate through the list and display a separate textbox for each element in the list, but I want each element to be listed in a single textArea. (similar to an actual email client in that you can enter multiple addresses separated by a comma or semi) Is this possible?
I’ve searched, but have not found this scenario, which seems odd, because I think it must not be uncommon.
I’m thinking the solution may be to write a custom editorTemplate, but I’m hoping for a simpler solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:45:33+00:00Added an answer on June 8, 2026 at 5:45 am

    You could extend you view model like so.

    View Model
    public class PeopleViewModel {

        public List<string> EmailAddress { get; set; }
    
        public string EmaiAddressString {
            get {
                string rValue = string.Empty;
                EmailAddress.ForEach(x => rValue += (x + "\n" ));
                return rValue;
            }
            set {
                var newValue = value.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ToList<string>();
                EmailAddress = newValue;
            }
    
        }
    }
    

    View

    @model SigKoExample.Models.PeopleViewModel
    @{
        ViewBag.Title = "Index";
    }
    <h2>Index</h2>
    @if (IsPost) {
        <h2>New Values</h2>
        @Html.TextArea("EmailAddresses", Model.EmaiAddressString.ToString())
    } else {
        using (Html.BeginForm()) { 
            @Html.TextAreaFor(m => m.EmaiAddressString)
            @Html.HiddenFor(m => m.EmailAddress)
            <input type="submit" value="Save" />                               
        }
    }
    

    Controller

    public ActionResult Index() {
        PeopleViewModel model = new PeopleViewModel {
            EmailAddress = new List<string> {
                "ValueOne",
                "ValueTwo"
            }
        };
        return View(model);
    }
    
    [HttpPost]
    public ActionResult Index(PeopleViewModel model) {
        return View(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple GUI form which has only 2 elements
I am trying to create a static HTML page which has a <form> which
im trying to create a semi-transparent form which is displayed in a panel. i
I'm trying to create a custom form element which extends Zend_Form_Element_Text with a validator
I'm trying to create a simple form with two different submit buttons: one which
I'm trying to create a simple form which calculates the values in every input
I'm trying to create a form that contains these multidimensional arrays: <input type=text name=cost[1][desc]>
I am trying to create a simple web form which will give me a
I am trying to create a form in Microsoft Access that has 2 ComboBoxes.
I am trying to create a form to edit an existing database row. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.