Manipulating the HTML DOM similar to jQuery with C# and ASP

Batz

New Member
I have a page with a table that is populated from a database. It looks a little something like this:\[code\]System Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec1 x x x x x x x x x x x x2 x x x x x x x x x x x x6 x x x x x x x x x x x x\[/code\]Each cell inside the table (IE each 'x' on the above diagram) contains a textbox that the user needs to enter a value into. I dynamically give each textbox an ID using the column title and the system number for example 'feb2', ' mar6', 'oct1'.At the bottom of the page is a save button that when pressed, will update the values in the database for all the systems and all the months.My problem is this: How can I get the values of the text boxes and call an sql function to update the values without first knowing the IDs of the text boxes?Here is an example of what I would like to do in jQuery (a language I am much more familiar with):\[code\]function saveValues(){ var rows = $("#SystemTargetsTable tr:not(:first-child)"); // skip the header row var systemID; var jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec; rows.each(function(index) { systemID = $(this).attr('id').substring(6); jan = $('#Jan' + systemID).val(); feb = $('#Feb' + systemID).val(); mar = $('#Mar' + systemID).val(); apr = $('#Apr' + systemID).val(); may = $('#May' + systemID).val(); jun = $('#Jun' + systemID).val(); jul = $('#Jul' + systemID).val(); aug = $('#Aug' + systemID).val(); sep = $('#Sep' + systemID).val(); oct = $('#Oct' + systemID).val(); nov = $('#Nov' + systemID).val(); dec = $('#Dec' + systemID).val(); //ONCE I HAVE THE VALUES FOR EACH MONTH I WOULD LIKE TO CALL AN UPDATE STATEMENT USING THE SYSTEM ID. ONLY OF COURSES I CANNOT DO TIS FROM JAVASCRIPT! }); } \[/code\]Thankyou for your time. I hope this all made sense!
 
Back
Top