Skip to content Skip to sidebar Skip to footer

Does Too Many Hidden Inputs Affect The Page Rendering Speed?

I'm at the point where I'll need to keep some data about my control in hidden fields. I'm using MVC 3 for the record. My worry is that I'll be using the hidden fields like a poor m

Solution 1:

You can avoid those extra hidden fields using custom attributes for your visible inputs

<inputtype="text"id="1" name="leg" data-id="101" />

Using jquery, you would get the data-id attribute like this

var id = $('#1').data('id');

As a side note and since you said that you have multiple rows, be sure you're not repeating your input ids.

Solution 2:

I too would strongly suggest using the jQuery-HTML5 data() API.

You should be using it if these values are complementary data.

See my answer to this question.

As for passing it to the controller, you could pass it via Ajax, if that's an option you can try.

$.ajax({
  url : '/Controller/Action/',
  data : { param1 : 'Hello' }
});

Post a Comment for "Does Too Many Hidden Inputs Affect The Page Rendering Speed?"