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

  • Home
  • SEARCH
  • 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 7003329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:03:17+00:00 2026-05-27T21:03:17+00:00

We have a ASP.net MVC 3 website.We had to store many values in hidden

  • 0

We have a ASP.net MVC 3 website.We had to store many values in hidden fields on client side that are required to be posted later on using AJAX. For some reason i’ve been using hidden div tags instead of hidden input fields believing it has some performance improvement.

<style>
.displaynone { display : none }
</style>

<div id="fld1" class="displaynone">Product Name</div>
<div id="fld2" class="displaynone">123 $</div>
<div id="fld3" class="displaynone">Catalog</div>

Any suggestions on what is the correct/best way ?

UPDATE:
Although i got my answer – semantically hidden fields are correct, adding details to get some more thoughts.

We have list of N number of items per page and each item has some information displayed on UI.Depending upon user action we have to add all data for selected item into another database table. Since we already have most of the data on UI, we decided to put few additional once as hidden fields per item and POSTed all the data instead of fetching it again from DB.

Point1-We could have made one FORM per item having all data required to be POSTed, but we used common Javascript function to POST data for item selected by user.

var fld1Val = $('fld1' + itemNo).text();

Point2-So we have set of hidden div tags (as given above) per item outside of FORM.

  1. @darin-dimitrov : If we have many items per page, does one FORM per item with different
    id is better than common function to POST data using AJAX ?

  2. @awrigley : If hidden input tags don’t have any meaning (semantic) outside of FORM, are they still better choice over hidden div in my case ?

Now

  • 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-27T21:03:18+00:00Added an answer on May 27, 2026 at 9:03 pm

    Hidden fields seem more semantically correct. You could simply serialize the entire form with a single $('#someForm').serialize() call and send it to the server:

    @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "myForm" }))
    {
        @Html.HiddenFor(x => x.ProductName)
        @Html.HiddenFor(x => x.Price)
        @Html.HiddenFor(x => x.Catalog)
    }
    

    and then:

    var form = $('#myForm');
    $.ajax({
        url: form.attr('action'),
        type: form.attr('method'),
        data: form.serialize(),
        success: function(result) {
            // TODO: do something with the results sent by the server
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC website that works in tandem with a Windows Service
I have an asp.net mvc website that returns a JSON result to certain pages
I have an Asp.net MVC website and for that I will making a lighter
I have an ASP.NET MVC website which has a particular javascript file that needs
I'm trying to ensure that visitors of my ASP.NET MVC website always have the
I have an ASP.NET MVC 3 website that communicates with my iOS app via
So I have an ASP.NET MVC 3 website that allows people to advertise certain
We have an ASP.NET MVC website that a customer is requesting Active Directory single
i have a asp.net mvc website and the volume of traffic is increasing. I
I have an ASP.Net MVC 3 Website hosted on a shared Windows hosting package.

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.