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 7889151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:01:21+00:00 2026-06-03T06:01:21+00:00

Ok, here is my situation, which has come to this… dramatic pause… I have

  • 0

Ok, here is my situation, which has come to this… dramatic pause…

I have the following TextAreaFor<> boxes in my MVC view:

        <div class="editor-label">
            <%: Html.LabelFor(model => model.Monday) %>
        </div>
        <div class="editor-field">
            <%: Html.TextAreaFor(model => model.Wednesday, 6, 40, new { })%>
            <%: Html.ValidationMessageFor(model => model.Monday) %>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.Wednesday) %>
        </div>
        <div class="editor-field">
            <%: Html.TextAreaFor(model => model.Wednesday, 6, 40, new {})%>
            <%: Html.ValidationMessageFor(model => model.Wednesday) %>
        </div>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.Friday) %>
        </div>
        <div class="editor-field">
            <%: Html.TextAreaFor(model => model.Friday, 6, 40, new {}) %>
            <%: Html.ValidationMessageFor(model => model.Friday) %>
        </div>

For those with a lot of experience, you might have noticed that I am using strongly Typed views to lessen development time, so a lot of the default items are here.

I need to know, how do I set the default values for the TextAreaFor<> boxes? I.E, I might want text in it which will serve as a Template. Whatever the user adds to these textAreas will be stored in a database (Back end for that is already complete and functional). As seen in the post ASP.NET MVC – How can I set the Default Value in a Strongly Typed TextArea?, I am not sure I can use this method, since I am not sure if the model variable will be sent back to my controller.

And another quick question (QuestionCeption) If I save data from these textAreas to the database (Using SQL Server Express 2008), will it conserve the new line characters?

Here is a sample of default values I will need.

Traditional:
Healthy Lifestyle:
Chill out:
Vegetarian:
Soup:
Sandwich:
No thanks.
  • 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-03T06:01:22+00:00Added an answer on June 3, 2026 at 6:01 am

    You could do that inside the controller action that is rendering this view:

    public ActionResult Index()
    {
        MyViewModel model = ...
        model.Friday = "some default value";
        return View(model);
    }
    

    and you will have a corresponding POST action which will retrieve the values:

    [HttpPost]
    public ActionResult Index(MyViewModel model)
    {
        // model.Friday will contain the text entered by the user in the corresponding textarea
        // here you could store for example the values in the database
        ...
    }
    

    And another quick question (QuestionCeption) If I save data from these
    textAreas to the database (Using SQL Server Express 2008), will it
    conserve the new line characters?

    Yes, you just need to save the text as-is in the database without doing any transformations. This will work when you display later the text in a textarea but if you want to display it for example in a <div> you will have to HTML encode it and replace the new lines by <br/>. For example you could write a custom HTML helper for this job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the situation I have a webpage which has one drop down called prefer.
Ok here goes my situation: I have a core-data generated class Quantity which has
Here is my situation, I have a div which has height:400px and overflow:auto to
So I have the following situation. I have a class DataTypes which has the
I have the following situation: I have site A, which has it's Mercurial repo,
Here is my situation. I have written a WCF service which calls into one
Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a
I have a situation which has to be simple to solve, I would guess.
Here's the situation, I created 6 pages,each of which has some text fields.I stored
Here's my situation - I've got a DB which has some tables named recipes

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.