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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:11:23+00:00 2026-05-28T11:11:23+00:00

I hope I explain this correctly.. What I am trying to do is build

  • 0

I hope I explain this correctly..
What I am trying to do is build up a session array with a list of products in.
Then display these on a form in text boxes with quantiles next to them and be able to submit them. I think I need to use template editor. But I don’t know how to put data into the list of items.

This is how my session variable is currently being populated..

 IList<EnqProduct> items2 = Session["enquiry"] as IList<EnqProduct>;
 desc = desc.Replace(",", "");
 EnqProduct item = new EnqProduct();
 item.Id = (items2.Count + 1).ToString();
 item.Product = desc;
 item.Quantity = "0";
 items2.Add(item);

So desc, can be productone, product two etc.

Enquiry Product model:

namespace MvcEditorTemplates.Models
{
    public class EnqProduct
    {
        public string Id { get; set; }
        public string Product { get; set; }
        public string Quantity { get; set; }
    }    
}

Normal Enquiry Model:

public class Enquiry
{ 
   public List<EnqProduct> EnqProduct { get; set; }
}

How i am trying to populate the model, but this is static. I need it to be populated from the array items:

var EnquiryModel = new Enquiry { 
EnqProduct = items2.Select(c => new EnqProduct()
{
       Quantity = c.Quantity,
       Product = c.Product
 })    
};

Enquiry product template view:

   @model MvcEditorTemplates.Models.EnqProduct
<div class="fl">
    <p>
        @Html.LabelFor(x => x.Product)
        @Html.TextBoxFor(x => x.Product)
    </p>   
    <p>
        @Html.LabelFor(x => x.Quantity)
        @Html.TextBoxFor(x => x.Quantity)
    </p>  
</div>

This is how im trying to get it to be displayed din the view:

 @Html.EditorFor(model => model.EnqProduct)

EDIT:

at items2.Select(c => new EnqProduct()

i get a IEnumerbale error something about cast?

  • 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-05-28T11:11:24+00:00Added an answer on May 28, 2026 at 11:11 am

    Try something like this:

    public class ErrorMessage
    {
        public DateTime ErrorDate { get; set; }
        public string ErrorText { get; set; }
        public int DexRowId { get; set; }
    }
    
    public class Transaction
    {
        public string TransactionType { get; set; }
        public string Processed { get; set; }
        public DateTime UpdateDate { get; set; }
        public int DexRowID { get; set; }
        public string Text { get; set; }
    }
    public class Result
    {
        public List<ErrorMessage> errorMessageList { get; set; }
        public List<Transaction> transactionList { get; set; }
    
    }
    

    In your controller:

    List<Transaction> transactionList = ...;//query to populate your list;
    List<ErrorMessage> errorMessageList = ...;//query to populate your list;
    
    Result result = new Result();
    result.ErrorMessageList = errorMessageList;
    result.TransactionList = transactionList;
    
    return View(result);
    

    and in your view:

    @model Models.Result
    @{
        ViewBag.Title = "Result";
        Layout = "~/Views/Shared/_ResultLayout.cshtml";
    }
    

    EDIT:

    @model IENumerable<MvcEditorTemplates.Models.EnqProduct>
    @{
    foreach( EnqProduct ep in @model)
    {
      .... your code comes here.........
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope I can explain this clearly enough. I have my main form (A)
I hope this I can explain what I am trying to achieve: I want
Hope I can explain this correctly.. Silverlight Application Telerik Reports (in a separate Class)
OK, I hope I explain this one correctly. I have a struct: typedef struct
Hope I am able to explain this correctly... I am able to connect to
This is odd, and I hope I explain it correctly. When I debug locally
I hope I can explain this well enough so that you can understand the
I hope I can explain this properly. I'm using flashDevelop for an avatar creation
I hope I can explain this right I have two input fields that require
I hope I'll be able to explain this properly. I'm developing a portlet for

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.