Retrieve data stored in tables

Please let me know some techniques (or methods) that would help me achieve the following:

The attached code allows the user to dynamically create/delete tables and its rows/columns.
When the user clicks "Save", I must save the state of the page, so that the user (when logged in) on my ASP.NET website can reload the page with all the saved tables and their contents.

So, I am guessing that I need to store the dimensions and IDs of each table, and their elements, and the values and then create empty tables of the same dimensions with appropriate values.

Is there a simple way to do this?

<style type="text/css">
body, p, td, div { font-family: Calibri, Arial, Tahoma; } /* Set the text in most tags to Calibri... */

table {
	margin:10px 0;
	border-collapse: collapse; /* */

tr { margin-top:2px; }

td {
	padding: 2px;
div.newcol a {
	text-decoration: none; /* turn off underlines for links in divs with className=newcol */
.xmark {
.xmark, .pmark, .pRowMark { /* turn off underlines for className=xmar, pmark or pRowMark and give the text the color 888888 */
.pmark {
	font-size: 22px;
	margin-left: -8px;

.xRowMark, .pRowMark {
	margin-right: 10px;
	margin-left: 65px;

.pRowMark {
	font-size: 22px;
	margin-right: 9px;

.xTableMark { /* turn off underlines for className=xmark, pmark or pRowMark and give the text the color 888888 and change the font-size. This could have been included above with xmark */

.xTableMark:hover { color:#F00; } /* change color on hovering over elements with className xmark or xTableMark */

.tableContainer {
	display: inline-block; /* */
	position: relative;
	padding: 0 20px 20px 0;
	overflow: visible;

.tableContainer img.button { /* image with className butto in tableContainer should be posisition absolutely and on top of other stuff */
	position: absolute;
	z-index: 1000;

.tableContainer img.button:hover { cursor: pointer; } /* change the cursor to a hand on hover */

.tableContainer img.newCol {
	top: 60px;
	right: 0px;
	width: 20px;
	height: 20px;

.tableContainer img.newRow {
	bottom: 5px;
	right: 100px;
	width: 16px;
	height: 16px;


Open in new window

Who is Participating?
wmadrid1Connect With a Mentor Commented:
Richard QuadlingConnect With a Mentor Senior Software DeveloperCommented:
The code you attached is only CSS styling.

But based upon your question, I would probably build a server side session that holds the dimensions and info and has it updated in realtime via AJAX calls.

So as a user adds a table/row/column, that info is sent immediately to the server.

The session can be logged in any way you want - file/db/etc.

In a way, all you are doing is duplicating the information about the tables/rows/columns that you have in JS onto the server. As the client changes, you sync that to the server.

strickddConnect With a Mentor Commented:
Basically you need to store all the information in your table to a hidden variable that will post to the server when the user clicks "Save". The hidden field can then be parsed and saved on the server-side however you see fit.

The other option is to do an AJAX post every time the user adds/removes a row and have the server-side event update the data as needed. This can cause problems in the long run with performance and accuracy. For example, if an AJAX call fails, the user won't necessarily see that in the browser unless you put in some error catching to revert back to the previous view of the table before the failed call.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.