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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:23:09+00:00 2026-06-12T19:23:09+00:00

As per a question that I asked yesterday I was trying to find a

  • 0

As per a question that I asked yesterday I was trying to find a way to dynamically create more text boxes and have those map to my view’s model so upon post to the server it will grab all the dynamically(js) generated text boxes and post that to an object such as a List.

To give an example of this confusing question:

I have a textbox that is labeled “Primary Contact” and the ticket creator can enter the contacts name and phone number into this box. What I want to do essentially is, switch this to three text boxes. One for Name, Email and PhoneNumber instead of one box. Then I will create some javascript that will dynamically create three more boxes to add another contact to this List collection. Then when the user submits the form to modify or create the ticket it passes this collection inside the model to the controller. However with petapoco it is a little confusing. Let me show you the controller:

[HttpPost]
public ActionResult ModifyTicket(Ticket model)
{
    string userString = User.Identity.Name.Replace("ONHOLD\\", "");
    if (ModelState.IsValid)
    {
         model.CreatedDate = DateTime.Now;
         model.LastUpdateBy = Util.GetEmployeeIdByName(userString);
         model.LastUpdate = DateTime.Now;
         model.IsComplete = false;
         model.ClientString = Util.GetClientNameById(model.ClientId);
         model.LocationString = Util.GetLocationNameById(model.LocationId);

         model.Update();

        SuccessMessage = "You have successfully updated ticket number: " + model.TicketId + " for the following client: " + model.ClientString + ".";
        return RedirectToAction("Index");
    }
        ErrorMessage = "Woops! Something went wrong, please check back in a few moments, if the problem persists please contact development.";
        return RedirectToAction("Index");
}

The simple answer to this would be that my database model would contain a List object for this exact reason. However, I am using PetaPoco and I’m not entirely sure how it would be done. I could manually add in a collection to my Database model but when I regenerate my model based on any database schema changes I will lose any changes I’ve made to the file.

I am also using a partial class that my view uses for validation using DataAnnotations. However this class is identical to the database model it just contains DataAnnotations to provide client-side validation.

If anyone understands what I’m trying to accomplish I would be more than happyto provide more information to clarify any missing pieces. I just need a resolution to this as I can’t find a solid way to go about resolving this issue!

  • 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-12T19:23:10+00:00Added an answer on June 12, 2026 at 7:23 pm

    Not entirely sure what you mean but it’s easy to model bind from/to a list with MVC as you may already know. As for saving a deep object like this I’d use the [Ignore] attribute on the Ticket.List so it isn’t persisted and handle it separately. I’d load the Contacts in separately from the Ticket object then manually add them to the Ticket object, alternatively use a join query and try the one-to-many approach to load it all in one go.

    I think you’re expecting Petapoco to update all in one? This won’t happen you’ll need to break it up. Hard to say from what you’ve written so far. There won’t be a long list of contacts (from the sounds of it) so just insert or update them one by one.

    Well that might help, or might not.

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

Sidebar

Related Questions

In a per-interview question i have been asked that How would you sort a
So, as per a separate question that I asked I'm using the following code
I guess this question that would have already been asked here. I searched but
I'm well aware that variants of this question have been asked before, but I
I have seen this question asked previously but can not find a clear explanation
As per another question I had asked earlier I think I may have found
Here's an interesting question that I'm shocked hasn't been asked more often on the
As per question says. Specifically i want the html.beginform() to have the runat=server attribute.
Per a great answer from another question I have begun mounting global resources (css/js/images)
As per the title I have three parts to this question... Is db4o object

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.