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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:53:20+00:00 2026-05-14T02:53:20+00:00

Assume you have a page in ASP.NET where it makes sense to use JavaScript/jQuery

  • 0

Assume you have a page in ASP.NET where it makes sense to use JavaScript/jQuery to modify the DOM with values that will eventually be read by the server on submit. For example, you have a form that allows end users to add/remove objects (like dependents on a health insurance form or assets on a loan application).

What are some ways to ensure that these items are detected and retrieved by the server once the information is submitted?

I’ve tried a few things that work, but none of them seem perfect so I wanted to see what the community had to offer.

Also, I’m not looking for suggestions that avoid dynamic DOM elements (like use a Wizard, etc.). I’m specifically trying to improve my technique with dynamically created DOM elements.

  • 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-14T02:53:20+00:00Added an answer on May 14, 2026 at 2:53 am

    There are two ways to do something like this:

    First: post only the information on submit. As long as you add both a name and an id attribute to every element in your DOM, every element is represented in Request.Form, so you can easily iterate through this collection.

    I tend to have a naming convention like insurance_row_1, insurance_row_2 and so forth. You can find all rows like Request.Form.AllKeys.Where(k=>k.StartsWith("insurance_row_")).


    When you want to save every action on the server:

    Maintain a state container in javascript, that holds information in some dictionary-like control, where you put every action that has been performed by your application, and a state whether the server has processed them. Something like:

    var stateContainer = [ 
             { 'put-insurance-row-1', false }, 
             { 'delete-insurance-row-1', false } 
    ];
    

    Do an AJAX request to the server to perform such an action, and use the state-container’s key to track whether the request succeeded or failed. Set the state to ‘true’ when the request has been successfully submitted. Make sure to do this in order in which you receive the events, so send them one-by-one to the server to ensure that you keep a valid state.

    You can (try) to prevent closing the browser if some states aren’t persisted yet.

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

Sidebar

Related Questions

Hello I have a page in an ASP.NET (website) project that writes a file
I have code in my ASP.NET master Page_Init event page that checks if a
I have an ASP.NET 4.0 application that implements URL routing. This gives me page
Assume I have an asp:GridView with some customer information. On that page I also
I have an app that calls my ASP.NET page on my server, every 30
I've got some JavaScript in an ASP.NET page that looks like this: var list
Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
Let's assume you have a big complex index page, that shows news articles and
I have an ASP.NET MVC web app whose controllers use WCF to call into
If I have an MVC3 ASP.net page which contains a the model iEnumerable<mymodel.CarsForHire> -

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.