954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can I access the datagrid data with javascript.

Here is html
[code]

I need to get values of both bound columns to use in calculations.
TIA
javascript newbie

sqlchopper
Newbie Poster
19 posts since Jan 2005
Reputation Points: 10
Solved Threads: 1
 

If the data are on the server computer, javascript can't see them, because javascript runs on the client computer.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

the script i show puts out a aleart showing that there is 82 rows in the datagrid. i just have not been able to figure out how to get to the columns to retieve the data. i've tried navroot.rows(i). col[0], cells[0], several things and no luck.

sqlchopper
Newbie Poster
19 posts since Jan 2005
Reputation Points: 10
Solved Threads: 1
 
<asp:table id="dmdTbl" style="Z-INDEX: 617; LEFT: 280px; POSITION: absolute; TOP: 552px" runat="server" Width="184px" Height="60px" >
 <asp:TableRow ID="drows" >
    <asp:TableCell ID="DmdDate" Enabled=False ></asp:TableCell>
    <asp:TableCell ID="Dqty" Enabled=False ></asp:TableCell>
 </asp:TableRow>
</asp:table>

code is this:
            var ord = 0;     // set up int
            var dd = new Date();   //set up date field
            //ord = document.getElementById('dmdTbl').rows.length;     // fid # of rows
            //alert("value "+ord);     //display number of rows
            var rowposi = document.getElementById('dmdTbl').rows;    // set position of row
            for (var i=0;i<document.getElementById('dmdTbl').rows.length;i++) {  
                 dd = rowposi[i].childNodes[0].innerText;
                 ord = rowposi[i].childNodes[1].innerText;
                 // ..... do something with dd and ord
                 //alert("value "+dd+"ord "+ord+"cnt "+i);   // show values
             }     // end for loop


I hope this help someone else.

sqlchopper
Newbie Poster
19 posts since Jan 2005
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You