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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:04:26+00:00 2026-06-09T18:04:26+00:00

here is my model namespace chPayroll.Models.CustInformations { public class CustContact { public int cId

  • 0

here is my model

namespace chPayroll.Models.CustInformations
{
    public class CustContact
    {
        public int cId { get; set; }
        public int cNoType { get; set; }
        public string cNo1 { get; set; }
        public string cNo2 { get; set; }
        public string cNo3 { get; set; }
        public List<CustContact> contact { get; set; }
    }
}

here is my editorTemplates

@model chPayroll.Models.CustInformations.CustContact         


@Html.TextBoxFor(model => model.cNo1)
@Html.TextBoxFor(model => model.cNo2)
@Html.TextBoxFor(model => model.cNo3)

I need to show three textbox for taking email,three text box for taking telephone no. in view. how can I add the items to the list contact defined in the model so that it shows like this

email:--textbox1----textbox2----textbox3--
telephone:--textbox1----textbox2----textbox3--

and sends value to the controller

actually I am trying to send my data in list named contact here ie inside list at

index 0-email1-email2-email3
index 1-tel1-tel2-tel3
  • 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-09T18:04:27+00:00Added an answer on June 9, 2026 at 6:04 pm

    @Sanjay: you have a strange construct in your view model:

    public class CustContact
    {
       public List<CustContact> contact;
    }
    

    Even if it compiles and machine understands it, I wouldn’t use it as it is – you trying to lift yourself from the ground by pulling your hair up 🙂

    It should be defined something along these lines (following your naming conventions & logic):

    public class CustContact // single
    {
        public int cId { get; set; }
        public int cNoType { get; set; }
        public string cNo1 { get; set; } // those are actual phones, emails etc data
        public string cNo2 { get; set; }
        public string cNo3 { get; set; }
    }
    
    public class CustContacts // plural
    {
       public List<CustContact> Contacts;
    }
    

    View:

    @model CustContacts
    @EditorFor(m => Model)
    

    Editor template:

    @model CustContact
    @Html.EditorFor(m => m.cNo1)
    @Html.EditorFor(m => m.cNo2)
    @Html.EditorFor(m => m.cNo3)
    

    For brevity, we don’t deal here with annotations, decorations, error handling etc.

    Hope this helps.

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

Sidebar

Related Questions

Here's my model: public class StockRequestModel { public int StockID { get; set; }
view model: namespace AESSmart.ViewModels { public class HomeIndexViewModel { public power_weatherstationhistory WeatherStationHistory {get;set;} public
Here is my model: public class RestoreRequestModel : IDataErrorInfo { //true seems Value contains
Here's sample model classes, which being use with Entity Framework Code First: public class
here is my model class gameUserTrophyInfo(models.Model): user = models.ForeignKey(userInfo) trophy = models.ForeignKey(gameTrophyInfo) date =
Here is a Django model I'm using. class Person(models.Model): surname = models.CharField(max_length=255, null=True, blank=True)
Here's my user model: class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable,
Hi i've got an extension method in my PagingHelpers class: namespace SportsStore.WebUI.HtmlHelpers { public
I have 2 models in different namespace. class Admin::Membership < ActiveRecord::Base has_many :authorization_roles end
I've created a WebService like this: [WebService(Namespace = http://ns)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class

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.