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

The Archive Base Latest Questions

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

I have a model like this : public class Person { public string Name

  • 0

I have a model like this :

public class Person
{
    public string Name {get;set;}
    public List<Pet> Pets {get;set;}
}

public class Pet
{
    public string Type {get;set;}
    public string Name {get;set;}
}

I want a user to capture all this information on a web page before submitting it to the server to save. I came up with a solution to build a table row for each pet that is captured by the user. So my javascript is adding rows to a table for each pet that is captured. When the user clicks on the Save button I build a javascript object:

person.name
person.pets[]

Then I submit this to the server.

The question is, is this the way to go or is there a better way, should I not rather add input elements for each pet, and submit a form?

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

    One common way to do this is with a client side $.ajax call (jQuery) and then a server-side service to consume the data as JSON.

    There is a template for automatically creating an ajax-enabled WCF service, at least in VS 2010. Here is a link:

    http://msdn.microsoft.com/en-us/library/bb924552.aspx

    Basic outline for the client-side script:

      $.ajax(             
      {                 
        type: "POST",                 
        contentType: "application/json; charset=utf-8",     
        url: "WcfService.svc/SomeMethod",                 
        data: JSON.stringify(params), //params is the name and pets data            
        dataType: "json",                 
        success: function (data, textStatus)        
        {
                // do something with the response if necessary
        }          
    

    You would also turn your classes into DataContracts:

     [DataContract]
     public class Person 
     {     
       [DataMember]
       public string Name {get;set;}   
    
       [DataMember]  
       public List<Pet> Pets {get;set;} 
     }  
    
     [DataContract]
     public class Pet 
     {     
       [DataMember]
       public string Type {get;set;}  
    
       [DataMember]    
       public string Name {get;set;} 
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this model : public class Person { public string Name { get;
Lets say I have a set of model classes like this: public class Person
I have the following model: public class Person { public string Name { get;
Given the classes: public class Person { public string Name { get; set; }
I have a model like this: public class Instrument { public string Id {
I have a custom class: public class Person { public String Name { get;
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I have a model that looks like this: public class UserAdminEditViewModel { public User
I have created a class Person that looks like this: public class Person {
I have the following domain model: public class Name { private readonly string fullName;

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.