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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:59:06+00:00 2026-06-04T14:59:06+00:00

i have problem to pass data from view to controller , i have view

  • 0

i have problem to pass data from view to controller , i have view that is strongly typed with my viewmodel “TimeLineModel”, in the first i passed to this view my viewmodel from action on my controller

public ActionResult confirmation(long socialbuzzCompaignId)
    {

      return View(new TimeLineModel() { socialBuzzCompaignId = socialbuzzCompaignId, BuzzMessages = model });

    }

with this i can get info from my action and display it on view , but i have other action POST which i won’t get my view model to do some traitement

    [HttpPost]
    public ActionResult confirmation(TimeLineModel model)
    {


    } 

i can get some propretie of the model but in others no , for example i can get the properti “socialBuzzCompaignId” of model , but other propertie like “IEnumerable BuzzMessages” i can’t get it , i dont now why !!
this is the content of my view

    @model Maya.Web.Models.TimeLineModel   
  @{
       ViewBag.Title = "confirmation";
    }
  @using (Html.BeginForm())
   {
     <h2>confirmation</h2>
       <fieldset>                       
          @foreach (var msg in Model.BuzzMessages)
          {                      
            <div class="editor-label">
              @msg.LongMessage
           </div>
           <br />
      }


    <p>
        <input type="submit" value="Save" />
    </p>

  </fieldset>

}
  • 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-04T14:59:07+00:00Added an answer on June 4, 2026 at 2:59 pm

    You need to include BuzzMessages properties within a form element. Since it’s not editable, you’d probably want to use hiddens. There are two ways to do this. Easiest is instead of doing a foreach loop, do a for loop and insert them by index.

    @for (int i =0; i<Model.BuzzMessages.Count(); i++v)
    {                      
        <div class="editor-label">
              @Model.BuzzMessages[i].LongMessage
              @Html.HiddenFor(m => m.BuzzMessages[i].LongMessage);
        </div>
           <br />
    }
    

    but to do this you’d need to use an IList instead of an IEnumerable in your view model to access by index.

    Alternatively, you could create an Editor Template named after your BuzzMessages class (whatever its name is).

    @model BuzzMessagesClass
    
    @Html.HiddenFor(m => m.LongMessages)
    <!-- Include other properties here if any -->
    

    and then in your main page

    @Html.EditorFor(m => m.BuzzMessages)
    

    Check out http://coding-in.net/asp-net-mvc-3-how-to-use-editortemplates/ or search stack overflow if the details of editor templates confuse you.

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

Sidebar

Related Questions

Many tutorials say that when i have to pass data from controller to view
I have this managedContextObject I want to pass from a view controller to another.
I have this little problem, that I cannot figure out which arguments to pass
In my MVC application I have a problem with passing data from view to
I Have two problem in this Case : I want to pass a JSON
I have multiple .xib files and multiple view controllers. Problem is when I pass
I've got some data in a view that I would like to pass to
I have the following two methods that get data from my DB and return
This is the code that I have in my controller: [HttpPost] public ActionResult UpdateArticle(Article
I have an Ember.js app as follows (borrowed from this article on andyMatthews.net): View:

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.