Here is html

<asp:datagrid id="mrpDataGrid" style="Z-INDEX: 289; LEFT: 576px; POSITION: absolute; TOP: 512px" runat="server" Width="160px" Height="90px" autogeneratecolumns="False">
<AlternatingItemStyle BackColor="LightGray"></AlternatingItemStyle>
  <asp:BoundColumn DataField="SCHEDULE_DT" HeaderText="Scheduled Date" DataFormatString="{0:d}"></asp:BoundColumn>
  <asp:BoundColumn DataField="SCHEDULE_QTs" HeaderText="Summed Quantity"></asp:BoundColumn>

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

Edited by happygeek: fixed formatting

9 Years
Discussion Span
Last Post by sqlchopper

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


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.

<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>

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.