Solved

Retrieve data stored in tables

Posted on 2011-09-04
3
209 Views
Last Modified: 2012-05-12
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?

Thanks!
<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; /* http://www.w3schools.com/css/pr_tab_border-collapse.asp */
}

tr { margin-top:2px; }

td {
	margin-left:2px;
	padding: 2px;
}
div.newcol a {
	text-decoration: none; /* turn off underlines for links in divs with className=newcol */
}
.xmark {
	font-size:14px;
}
.xmark, .pmark, .pRowMark { /* turn off underlines for className=xmar, pmark or pRowMark and give the text the color 888888 */
	color:#888;
	text-decoration:none; 
}
.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 */
	font-size:18px;
	color:#888;
	text-decoration:none;
}

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

.tableContainer {
	display: inline-block; /* http://www.w3schools.com/css/pr_class_display.asp */
	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;
}

</style>

Open in new window

0
Comment
Question by:dshrenik
3 Comments
 
LVL 40

Assisted Solution

by:RQuadling
RQuadling earned 166 total points
ID: 36483211
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.

0
 
LVL 5

Accepted Solution

by:
wmadrid1 earned 167 total points
ID: 36484829
0
 
LVL 28

Assisted Solution

by:strickdd
strickdd earned 167 total points
ID: 36489895
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.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now