Reputation: 53263
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?
Upvotes: 1
Views: 3114
Reputation: 12417
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;}
Upvotes: 4
Reputation: 6054
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.
Upvotes: 0