Question

I would like to store some business flags (like: isFavorite, isOnLive etc.) per an html table row that won't be visible to user.

In practice, I have a simple ADO.Net DataTable on my code-behind which is used as a data-source for a asp.Net GridView control.

This table contains some business flags on its 0th, 1st, 2nd columns.

I need to store those columns on the rendered HTML of the grid-view -so that I can reach them via JavaScript- but I do not want them to be visible.

Can you recommend me the best practice for such a case?

Was it helpful?

Solution

Assign a style to the cells to hide them:

<tr>
  <td>Cell 1</td>
  <td>Cell 2</td>
  <td>Cell 3</td>
  <td class="hidden">Cell X</td>
</tr>

In your style sheet:

td.hidden {display: none;}

OTHER TIPS

You can set them in hidden input fields in a template column in your gridview. Just set the column to not visible.

You can find the hidden controls in javaScript and use its' values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top