Solved

Retrieve value of table cell...

Posted on 2004-03-26
4
580 Views
Last Modified: 2007-12-19
Have a datagrid.  In Javascript I read through the datagrid using a datatable called 'mytable'.
The datagrid has both template and bound columns.  I can read the template column values OK but having trouble reading the text value of the bound columns.  Here is a snippet from the
script that reads the value of the template columns:

      for( x = 1; x < mytable.rows.length; x++ )
            {
                  y=x+1;
                  ctlCBVal=document.getElementById("dgPOItems__ctl"+y+"_ReceiveProduct").checked;
                  ctlRecvQtyVal=document.getElementById("dgPOItems__ctl"+y+"_QtyReceived").value;
                  ctlRefQty=document.getElementById("dgPOItems__ctl"+y+"_QtyRefused").value;
                  ctlPaidPrice=document.getElementById("dgPOItems__ctl"+y+"_PaidPrice").value;


     The bound column is named "QtyOrd" and I'm not exactly sure how to use mytable to extract the value from its cell.

0
Comment
Question by:gsmithaaa
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
gronog earned 50 total points
ID: 10697777
you could generate an unique ID tag for each TD of your table, and use it to retrieve your value

document.getElementById('TheIdMayBeForgedByappendingXandYPositions').firstChild.value
0
 
LVL 1

Expert Comment

by:gronog
ID: 10697785
or, if you want to reduce the size of the generated HTML (that is, if you dont want to add an ID tag to each TD,
you could jump from cell to cell using nextSibling...
but that is error prone and less robust.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Read about why website design really matters in today's demanding market.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.

758 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

20 Experts available now in Live!

Get 1:1 Help Now